[llvm-branch-commits] [cfe-branch] r142428 - in /cfe/branches/release_30: ./ include/clang/Frontend/PreprocessorOptions.h lib/Frontend/CompilerInvocation.cpp test/Modules/Inputs/CmdLine.framework/ test/Modules/Inputs/CmdLine.framework/Headers/ test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h test/Modules/on-demand-build-warnings.m test/Modules/on-demand-build.m test/Modules/on-demand-macros.m test/SemaCXX/warn-unreachable.cpp

Bill Wendling isanbard at gmail.com
Tue Oct 18 14:54:53 PDT 2011


Author: void
Date: Tue Oct 18 16:54:53 2011
New Revision: 142428

URL: http://llvm.org/viewvc/llvm-project?rev=142428&view=rev
Log:
Merging r142187:
------------------------------------------------------------------------
r142187 | dgregor | 2011-10-17 07:55:37 -0700 (Mon, 17 Oct 2011) | 6 lines

When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.

------------------------------------------------------------------------

Added:
    cfe/branches/release_30/test/Modules/Inputs/CmdLine.framework/
      - copied from r142187, cfe/trunk/test/Modules/Inputs/CmdLine.framework/
    cfe/branches/release_30/test/Modules/Inputs/CmdLine.framework/Headers/
      - copied from r142187, cfe/trunk/test/Modules/Inputs/CmdLine.framework/Headers/
    cfe/branches/release_30/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h
      - copied unchanged from r142187, cfe/trunk/test/Modules/Inputs/CmdLine.framework/Headers/CmdLine.h
    cfe/branches/release_30/test/Modules/on-demand-macros.m
      - copied unchanged from r142187, cfe/trunk/test/Modules/on-demand-macros.m
Modified:
    cfe/branches/release_30/   (props changed)
    cfe/branches/release_30/include/clang/Frontend/PreprocessorOptions.h
    cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp
    cfe/branches/release_30/test/Modules/on-demand-build-warnings.m
    cfe/branches/release_30/test/Modules/on-demand-build.m
    cfe/branches/release_30/test/SemaCXX/warn-unreachable.cpp   (props changed)

Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 18 16:54:53 2011
@@ -1,3 +1,3 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142349
+/cfe/trunk:142113,142133-142134,142187,142349
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_30/include/clang/Frontend/PreprocessorOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/include/clang/Frontend/PreprocessorOptions.h?rev=142428&r1=142427&r2=142428&view=diff
==============================================================================
--- cfe/branches/release_30/include/clang/Frontend/PreprocessorOptions.h (original)
+++ cfe/branches/release_30/include/clang/Frontend/PreprocessorOptions.h Tue Oct 18 16:54:53 2011
@@ -206,7 +206,6 @@
   /// \brief Reset any options that are not considered when building a
   /// module.
   void resetNonModularOptions() {
-    Macros.clear();
     Includes.clear();
     MacroIncludes.clear();
     ChainedIncludes.clear();

Modified: cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp?rev=142428&r1=142427&r2=142428&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp Tue Oct 18 16:54:53 2011
@@ -2026,6 +2026,23 @@
   Signature.add(getPreprocessorOpts().UsePredefines, 1);
   Signature.add(getPreprocessorOpts().DetailedRecord, 1);
   
+  // Hash the preprocessor defines.
+  // FIXME: This is terrible. Use an MD5 sum of the preprocessor defines.
+  std::vector<StringRef> MacroDefs;
+  for (std::vector<std::pair<std::string, bool/*isUndef*/> >::const_iterator 
+            I = getPreprocessorOpts().Macros.begin(),
+         IEnd = getPreprocessorOpts().Macros.end();
+       I != IEnd; ++I) {
+    if (!I->second)
+      MacroDefs.push_back(I->first);
+  }
+  llvm::array_pod_sort(MacroDefs.begin(), MacroDefs.end());
+       
+  unsigned PPHashResult = 0;
+  for (unsigned I = 0, N = MacroDefs.size(); I != N; ++I)
+    PPHashResult = llvm::HashString(MacroDefs[I], PPHashResult);
+  Signature.add(PPHashResult, 32);
+  
   // We've generated the signature. Treat it as one large APInt that we'll
   // encode in base-36 and return.
   Signature.flush();

Modified: cfe/branches/release_30/test/Modules/on-demand-build-warnings.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/test/Modules/on-demand-build-warnings.m?rev=142428&r1=142427&r2=142428&view=diff
==============================================================================
--- cfe/branches/release_30/test/Modules/on-demand-build-warnings.m (original)
+++ cfe/branches/release_30/test/Modules/on-demand-build-warnings.m Tue Oct 18 16:54:53 2011
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s
 
 __import_module__ Module; // expected-warning{{building module 'Module' from source}}
 

Modified: cfe/branches/release_30/test/Modules/on-demand-build.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/test/Modules/on-demand-build.m?rev=142428&r1=142427&r2=142428&view=diff
==============================================================================
--- cfe/branches/release_30/test/Modules/on-demand-build.m (original)
+++ cfe/branches/release_30/test/Modules/on-demand-build.m Tue Oct 18 16:54:53 2011
@@ -1,8 +1,8 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -DFOO -verify %s
-
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -verify %s
+// RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -fmodule-cache-path %t -F %S/Inputs -verify %s
+#define FOO
 __import_module__ Module;
 @interface OtherClass
 @end

Propchange: cfe/branches/release_30/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Oct 18 16:54:53 2011
@@ -1,2 +1,2 @@
 /cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,142113,142133-142134,142349
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,142113,142133-142134,142187,142349





More information about the llvm-branch-commits mailing list