Skip to content

[Driver][SYCL] Restrict user -include file in final integration foote… #4036

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
Jul 1, 2021
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
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,11 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
<< A->getAsString(Args);
}
}
// Do not render -include when performing the compilation that occurs
// after the the integration footer has been appended. This has already
// been preprocessed and should not be included again.
if (ContainsAppendFooterAction(&JA))
continue;
} else if (A->getOption().matches(options::OPT_isystem_after)) {
// Handling of paths which must come late. These entries are handled by
// the toolchain itself after the resource dir is inserted in the right
Expand Down
11 changes: 8 additions & 3 deletions clang/test/Driver/sycl-int-footer.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
/// Check compilation tool steps when using the integration footer
// RUN: %clangxx -fsycl %s -### 2>&1 \
// RUN: %clangxx -fsycl -include dummy.h %s -### 2>&1 \
// RUN: | FileCheck -check-prefix FOOTER %s
// FOOTER: clang{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-int-header=[[INTHEADER:.+\.h]]" "-fsycl-int-footer=[[INTFOOTER:.+\h]]" "-sycl-std={{.*}}"
// FOOTER: clang{{.*}} "-include" "[[INTHEADER]]"{{.*}} "-fsycl-is-host"{{.*}} "-E"{{.*}} "-C"{{.*}} "-o" "[[PREPROC:.+\.ii]]"
// FOOTER: clang{{.*}} "-fsycl-is-device"{{.*}} "-fsycl-int-header=[[INTHEADER:.+\.h]]" "-fsycl-int-footer=[[INTFOOTER:.+\h]]" "-sycl-std={{.*}}"{{.*}} "-include" "dummy.h"
// FOOTER: clang{{.*}} "-include" "[[INTHEADER]]"{{.*}} "-fsycl-is-host"{{.*}} "-E"{{.*}} "-C"{{.*}} "-include" "dummy.h"{{.*}} "-o" "[[PREPROC:.+\.ii]]"
// FOOTER: append-file{{.*}} "[[PREPROC]]" "--append=[[INTFOOTER]]" "--output=[[APPENDEDSRC:.+\.cpp]]"
// FOOTER: clang{{.*}} "-fsycl-is-host"{{.*}} "[[APPENDEDSRC]]"
// FOOTER-NOT: "-include" "[[INTHEADER]]"

// RUN: %clangxx -fsycl -include dummy.h %s -### 2>&1 \
// RUN: | FileCheck -check-prefix FOOTER_NO_HEADER %s
// FOOTER_NO_HEADER: append-file{{.*}}
// FOOTER_NO_HEADER-NOT: clang{{.*}} "-include" "dummy.h"

/// Preprocessed file creation with integration footer
// RUN: %clangxx -fsycl -E %s -### 2>&1 \
// RUN: | FileCheck -check-prefix FOOTER_PREPROC_GEN %s
Expand Down