Skip to content

[ClangImporter] Include -Xcc options in the PCH hash #27482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/swift/ClangImporter/ClangImporterOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class ClangImporterOptions {
using llvm::hash_combine;

auto Code = hash_value(ModuleCachePath);
// ExtraArgs ignored - already considered in Clang's module hashing.
Code = hash_combine(Code, llvm::hash_combine_range(ExtraArgs.begin(),
ExtraArgs.end()));
Code = hash_combine(Code, OverrideResourceDir);
Code = hash_combine(Code, TargetCPU);
Code = hash_combine(Code, BridgingHeader);
Expand Down
6 changes: 6 additions & 0 deletions test/ClangImporter/pch-bridging-header.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
// RUN: not %target-swift-frontend -typecheck %s -import-objc-header %S/Inputs/sdk-bridging-header.h -pch-output-dir %t/no-pch -pch-disable-validation 2>&1 | %FileCheck %s -check-prefix=NO-VALIDATION
// NO-VALIDATION: PCH file {{.*}} not found

// Test that -Xcc options are considered in the PCH hash.
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h -Xcc -Ifoo
// RUN: %target-swift-frontend -emit-pch -pch-output-dir %t/pch-Xcc %S/Inputs/sdk-bridging-header.h -Xcc -Ibar
// RUN: ls %t/pch-Xcc/*swift*clang*.pch | count 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think count just prints the number of elements, it doesn't validate how many elements were passed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, actually! I made sure to test this with the 5.1 compiler.

(I think it's an LLVM tool, not a shell builtin.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


import Foundation

let not = MyPredicate.not()
Expand Down