summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp5
-rw-r--r--clang/test/Modules/Inputs/PR27041/Rtypes.h1
-rw-r--r--clang/test/Modules/Inputs/PR27041/TGenericClassInfo.h3
-rw-r--r--clang/test/Modules/Inputs/PR27041/TSchemaHelper.h1
-rw-r--r--clang/test/Modules/Inputs/PR27041/module.modulemap2
-rw-r--r--clang/test/Modules/pr27041.cpp7
6 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index a828d350c04..78fc6eb4baa 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -3340,7 +3340,10 @@ void ASTWriter::WriteIdentifierTable(Preprocessor &PP,
auto *II = const_cast<IdentifierInfo *>(IdentIDPair.first);
IdentID ID = IdentIDPair.second;
assert(II && "NULL identifier in identifier table");
- if (!Chain || !II->isFromAST() || II->hasChangedSinceDeserialization() ||
+ // Write out identifiers if either the ID is local or the identifier has
+ // changed since it was loaded.
+ if (ID >= FirstIdentID || !Chain || !II->isFromAST()
+ || II->hasChangedSinceDeserialization() ||
(Trait.needDecls() &&
II->hasFETokenInfoChangedSinceDeserialization()))
Generator.insert(II, ID, Trait);
diff --git a/clang/test/Modules/Inputs/PR27041/Rtypes.h b/clang/test/Modules/Inputs/PR27041/Rtypes.h
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27041/Rtypes.h
@@ -0,0 +1 @@
+
diff --git a/clang/test/Modules/Inputs/PR27041/TGenericClassInfo.h b/clang/test/Modules/Inputs/PR27041/TGenericClassInfo.h
new file mode 100644
index 00000000000..b43b2c90f22
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27041/TGenericClassInfo.h
@@ -0,0 +1,3 @@
+namespace std {}
+namespace std { enum float_round_style { denorm_present }; }
+#include "TSchemaHelper.h"
diff --git a/clang/test/Modules/Inputs/PR27041/TSchemaHelper.h b/clang/test/Modules/Inputs/PR27041/TSchemaHelper.h
new file mode 100644
index 00000000000..31f726f4d75
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27041/TSchemaHelper.h
@@ -0,0 +1 @@
+namespace std { enum float_round_style { denorm_present }; }
diff --git a/clang/test/Modules/Inputs/PR27041/module.modulemap b/clang/test/Modules/Inputs/PR27041/module.modulemap
new file mode 100644
index 00000000000..f0147cdf976
--- /dev/null
+++ b/clang/test/Modules/Inputs/PR27041/module.modulemap
@@ -0,0 +1,2 @@
+module "Rtypes.h" { header "Rtypes.h" header "TGenericClassInfo.h" }
+module "TSchemaHelper.h" { header "TSchemaHelper.h" }
diff --git a/clang/test/Modules/pr27041.cpp b/clang/test/Modules/pr27041.cpp
new file mode 100644
index 00000000000..9d06468b97b
--- /dev/null
+++ b/clang/test/Modules/pr27041.cpp
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR27041 -verify %s
+// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR27041/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR27041 -verify %s
+
+#include "Rtypes.h"
+
+// expected-no-diagnostics
OpenPOWER on IntegriCloud