Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ODRHash] Do not rely on Type* when computing the hash.
ODRHash aims to provide Cross-TU stable hashing. Making clang::Type pointer part of the hash connects (remotely) the ODRHash with the TU-specific ::Profile hasher. r332281 exposed the issue by changing the way the ASTContext different elaborated types if there is an owning tag. In that case, ODRHash stores two different types in its TypeMap which yields false ODR violation in modules. The current state of implementation shouldn't need the TypeMap concept anymore. Rip it out. Differential Revision: https://reviews.llvm.org/D48524 llvm-svn: 335853
- Loading branch information
1 parent
63feb16
commit 61914d3
Showing
8 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef FIRST | ||
#define FIRST | ||
|
||
#include "textual_time.h" | ||
|
||
#endif |
5 changes: 5 additions & 0 deletions
5
clang/test/Modules/Inputs/odr_hash-elaborated-types/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module M { | ||
module first { header "first.h" export *} | ||
module second { header "second.h" export *} | ||
export * | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef SECOND | ||
#define SECOND | ||
|
||
#include "textual_stat.h" | ||
|
||
#endif |
11 changes: 11 additions & 0 deletions
11
clang/test/Modules/Inputs/odr_hash-elaborated-types/textual_stat.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef _SYS_STAT_H | ||
#define _SYS_STAT_H | ||
|
||
#include "textual_time.h" | ||
|
||
struct stat { | ||
struct timespec st_atim; | ||
struct timespec st_mtim; | ||
}; | ||
|
||
#endif |
6 changes: 6 additions & 0 deletions
6
clang/test/Modules/Inputs/odr_hash-elaborated-types/textual_time.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef _TIME_H | ||
#define _TIME_H | ||
|
||
struct timespec { }; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 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 |