// Use DenseMaps to convert from DeclarationName and Type pointers
// to an index value.
llvm::DenseMap<DeclarationName, unsigned> DeclNameMap;
- llvm::DenseMap<const Type*, unsigned> TypeMap;
// Save space by processing bools at the end.
llvm::SmallVector<bool, 128> Bools;
void ODRHash::clear() {
DeclNameMap.clear();
- TypeMap.clear();
Bools.clear();
ID.clear();
}
void ODRHash::AddType(const Type *T) {
assert(T && "Expecting non-null pointer.");
- auto Result = TypeMap.insert(std::make_pair(T, TypeMap.size()));
- ID.AddInteger(Result.first->second);
- // On first encounter of a Type pointer, process it. Every time afterwards,
- // only the index value is needed.
- if (!Result.second) {
- return;
- }
-
ODRTypeVisitor(ID, *this).Visit(T);
}
--- /dev/null
+#ifndef FIRST
+#define FIRST
+
+#include "textual_time.h"
+
+#endif
--- /dev/null
+module M {
+ module first { header "first.h" export *}
+ module second { header "second.h" export *}
+ export *
+}
--- /dev/null
+#ifndef SECOND
+#define SECOND
+
+#include "textual_stat.h"
+
+#endif
--- /dev/null
+#ifndef _SYS_STAT_H
+#define _SYS_STAT_H
+
+#include "textual_time.h"
+
+struct stat {
+ struct timespec st_atim;
+ struct timespec st_mtim;
+};
+
+#endif
--- /dev/null
+#ifndef _TIME_H
+#define _TIME_H
+
+struct timespec { };
+
+#endif
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++1z -I%S/Inputs/odr_hash-elaborated-types -verify %s
+// RUN: %clang_cc1 -std=c++1z -fmodules -fmodules-local-submodule-visibility -fmodule-map-file=%S/Inputs/odr_hash-elaborated-types/module.modulemap -fmodules-cache-path=%t -x c++ -I%S/Inputs/odr_hash-elaborated-types -verify %s
+
+#include "textual_stat.h"
+
+#include "first.h"
+#include "second.h"
+
+void use() { struct stat value; }
+
+// expected-no-diagnostics