Don't attempt to merge a deserialized declaration with existing

declarations in the AST unless modules are enabled. This case doesn't
come up with precompiled headers, and it isn't cheap.

llvm-svn: 147451
This commit is contained in:
Douglas Gregor 2012-01-03 17:31:38 +00:00
parent 2c46b5bd07
commit e097d4ba26
2 changed files with 6 additions and 2 deletions

View File

@ -1512,6 +1512,10 @@ ASTDeclReader::VisitRedeclarable(Redeclarable<T> *D) {
template<typename T>
void ASTDeclReader::mergeRedeclarable(Redeclarable<T> *D,
RedeclarableResult &Redecl) {
// If modules are not available, there is no reason to perform this merge.
if (!Reader.getContext().getLangOptions().Modules)
return;
if (FindExistingResult ExistingRes = findExisting(static_cast<T*>(D))) {
if (T *Existing = ExistingRes) {
T *ExistingCanon = Existing->getCanonicalDecl();

View File

@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodule-cache-path %t -I %S/Inputs %s -verify
// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -I %S/Inputs %s -verify
// RUN: %clang_cc1 -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify
// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify
@class C2;
@class C3;
@class C3;