r207570 - [PCH/Modules] Don't tie TargetOptions::LinkerVersion to a module/PCH, it's a driver only thing and doesn't affect any language/preprocessor/etc. semantics.

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Apr 29 11:45:02 PDT 2014


Author: akirtzidis
Date: Tue Apr 29 13:45:01 2014
New Revision: 207570

URL: http://llvm.org/viewvc/llvm-project?rev=207570&view=rev
Log:
[PCH/Modules] Don't tie TargetOptions::LinkerVersion to a module/PCH, it's a driver only thing and doesn't affect any language/preprocessor/etc. semantics.

rdar://16714526

Added:
    cfe/trunk/test/PCH/different-linker-version.c
Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Frontend/FrontendActions.cpp
    cfe/trunk/lib/Serialization/ASTReader.cpp
    cfe/trunk/lib/Serialization/ASTWriter.cpp
    cfe/trunk/test/Modules/module_file_info.m

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=207570&r1=207569&r2=207570&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Apr 29 13:45:01 2014
@@ -1819,7 +1819,7 @@ std::string CompilerInvocation::getModul
   
   // Extend the signature with the target options.
   code = hash_combine(code, TargetOpts->Triple, TargetOpts->CPU,
-                      TargetOpts->ABI, TargetOpts->LinkerVersion);
+                      TargetOpts->ABI);
   for (unsigned i = 0, n = TargetOpts->FeaturesAsWritten.size(); i != n; ++i)
     code = hash_combine(code, TargetOpts->FeaturesAsWritten[i]);
 

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=207570&r1=207569&r2=207570&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Tue Apr 29 13:45:01 2014
@@ -446,7 +446,6 @@ namespace {
       Out.indent(4) << "  Triple: " << TargetOpts.Triple << "\n";
       Out.indent(4) << "  CPU: " << TargetOpts.CPU << "\n";
       Out.indent(4) << "  ABI: " << TargetOpts.ABI << "\n";
-      Out.indent(4) << "  Linker version: " << TargetOpts.LinkerVersion << "\n";
 
       if (!TargetOpts.FeaturesAsWritten.empty()) {
         Out.indent(4) << "Target features:\n";

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=207570&r1=207569&r2=207570&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Apr 29 13:45:01 2014
@@ -219,7 +219,6 @@ static bool checkTargetOptions(const Tar
   CHECK_TARGET_OPT(Triple, "target");
   CHECK_TARGET_OPT(CPU, "target CPU");
   CHECK_TARGET_OPT(ABI, "target ABI");
-  CHECK_TARGET_OPT(LinkerVersion, "target linker version");
 #undef CHECK_TARGET_OPT
 
   // Compare feature sets.
@@ -4583,7 +4582,6 @@ bool ASTReader::ParseTargetOptions(const
   TargetOpts.Triple = ReadString(Record, Idx);
   TargetOpts.CPU = ReadString(Record, Idx);
   TargetOpts.ABI = ReadString(Record, Idx);
-  TargetOpts.LinkerVersion = ReadString(Record, Idx);
   for (unsigned N = Record[Idx++]; N; --N) {
     TargetOpts.FeaturesAsWritten.push_back(ReadString(Record, Idx));
   }

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=207570&r1=207569&r2=207570&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Tue Apr 29 13:45:01 2014
@@ -1136,7 +1136,6 @@ void ASTWriter::WriteControlBlock(Prepro
   AddString(TargetOpts.Triple, Record);
   AddString(TargetOpts.CPU, Record);
   AddString(TargetOpts.ABI, Record);
-  AddString(TargetOpts.LinkerVersion, Record);
   Record.push_back(TargetOpts.FeaturesAsWritten.size());
   for (unsigned I = 0, N = TargetOpts.FeaturesAsWritten.size(); I != N; ++I) {
     AddString(TargetOpts.FeaturesAsWritten[I], Record);

Modified: cfe/trunk/test/Modules/module_file_info.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module_file_info.m?rev=207570&r1=207569&r2=207570&view=diff
==============================================================================
--- cfe/trunk/test/Modules/module_file_info.m (original)
+++ cfe/trunk/test/Modules/module_file_info.m Tue Apr 29 13:45:01 2014
@@ -19,7 +19,6 @@
 // CHECK:     Triple:
 // CHECK:     CPU: 
 // CHECK:     ABI: 
-// CHECK:     Linker version: 
 
 // CHECK: Diagnostic options:
 // CHECK:   IgnoreWarnings: Yes

Added: cfe/trunk/test/PCH/different-linker-version.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/different-linker-version.c?rev=207570&view=auto
==============================================================================
--- cfe/trunk/test/PCH/different-linker-version.c (added)
+++ cfe/trunk/test/PCH/different-linker-version.c Tue Apr 29 13:45:01 2014
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -target-linker-version 100 -emit-pch %s -o %t.h.pch
+// RUN: %clang_cc1 -target-linker-version 200 %s -include-pch %t.h.pch -fsyntax-only -verify
+
+#ifndef HEADER
+#define HEADER
+
+extern int foo;
+
+#else
+
+void f() {
+  int a = foo;
+  // Make sure we parsed this by getting an error.
+  int b = bar; // expected-error {{undeclared}}
+}
+
+#endif





More information about the cfe-commits mailing list