[cfe-commits] r147451 - in /cfe/trunk: lib/Serialization/ASTReaderDecl.cpp test/Modules/redecl-merge.m

Douglas Gregor dgregor at apple.com
Tue Jan 3 09:31:38 PST 2012


Author: dgregor
Date: Tue Jan  3 11:31:38 2012
New Revision: 147451

URL: http://llvm.org/viewvc/llvm-project?rev=147451&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
    cfe/trunk/test/Modules/redecl-merge.m

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=147451&r1=147450&r2=147451&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Jan  3 11:31:38 2012
@@ -1512,6 +1512,10 @@
 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();

Modified: cfe/trunk/test/Modules/redecl-merge.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/redecl-merge.m?rev=147451&r1=147450&r2=147451&view=diff
==============================================================================
--- cfe/trunk/test/Modules/redecl-merge.m (original)
+++ cfe/trunk/test/Modules/redecl-merge.m Tue Jan  3 11:31:38 2012
@@ -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;





More information about the cfe-commits mailing list