aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-05-30Revert "[HLSL] Enable vector types for hlsl."Nico Weber1-4/+0
This reverts commit e576280380d3f5221cfcc14e9fabeacc8506a43c. Breaks tests on mac/arm, see comment on https://reviews.llvm.org/D125052 Also revert follow-up "[gn build] Port e576280380d3" This reverts commit 1e01b1ec72031fcaceb4e77e1c5c8e34f1e862e8.
2022-05-30[HLSL] Enable vector types for hlsl.Xiang Li1-0/+4
Vector types in hlsl is using clang ext_vector_type. Declaration of vector types is in builtin header hlsl.h. hlsl.h will be included by default for hlsl shader. Reviewed By: Anastasia Differential Revision: https://reviews.llvm.org/D125052
2022-05-25Move GCC-compatible pod-packing change to v15/old behavior available at v14 ↵David Blaikie1-4/+0
and below Since this didn't make it into the v14 release - anyone requesting the v14 ABI shouldn't get this GCC-compatible change that isn't backwards compatible with v14 Clang. Differential Revision: https://reviews.llvm.org/D126334
2022-05-11[clang] Add the flag -ffile-reproducibleAlan Zhao1-0/+11
When Clang generates the path prefix (i.e. the path of the directory where the file is) when generating FILE, __builtin_FILE(), and std::source_location, Clang uses the platform-specific path separator character of the build environment where Clang _itself_ is built. This leads to inconsistencies in Chrome builds where Clang running on non-Windows environments uses the forward slash (/) path separator while Clang running on Windows builds uses the backslash (\) path separator. To fix this, we add a flag -ffile-reproducible (and its inverse, -fno-file-reproducible) to have Clang use the target's platform-specific file separator character. Additionally, the existing flags -fmacro-prefix-map and -ffile-prefix-map now both imply -ffile-reproducible. This can be overriden by setting -fno-file-reproducible. [0]: https://crbug.com/1310767 Differential revision: https://reviews.llvm.org/D122766
2022-05-11[clang][AIX] Don't ignore XCOFF visibility by defaultDavid Tenty1-22/+1
D87451 added -mignore-xcoff-visibility for AIX targets and made it the default (which mimicked the behaviour of the XL 16.1 compiler on AIX). However, ignoring hidden visibility has unwanted side effects and some libraries depend on visibility to hide non-ABI facing entities from user headers and reserve the right to change these implementation details based on this (https://libcxx.llvm.org/DesignDocs/VisibilityMacros.html). This forces us to use internal linkage fallbacks for these cases on AIX and creates an unwanted divergence in implementations on the plaform. For these reasons, it's preferable to not add -mignore-xcoff-visibility by default, which is what this patch does. Reviewed By: DiggerLin Differential Revision: https://reviews.llvm.org/D125141
2022-05-02Mark identifier prefixes as substitutableHarald van Dijk1-0/+4
The Itanium C++ ABI says prefixes are substitutable. For most prefixes we already handle this: the manglePrefix(const DeclContext *, bool) and manglePrefix(QualType) overloads explicitly handles substitutions or defer to functions that handle substitutions on their behalf. The manglePrefix(NestedNameSpecifier *) overload, however, is different and handles some cases implicitly, but not all. The Identifier case was not handled; this change adds handling for it, as well as a test case. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D122663
2022-04-29Additionally set f32 mode with denormal-fp-mathDavid Candler1-1/+3
When the denormal-fp-math option is used, this should set the denormal handling mode for all floating point types. However, currently 32-bit float types can ignore this setting as there is a variant of the option, denormal-fp-math-f32, specifically for that type which takes priority when checking the mode based on type and remains at the default of IEEE. From the description, denormal-fp-math would be expected to set the mode for floats unless overridden by the f32 variant, and code in the front end only emits the f32 option if it is different to the general one, so setting just denormal-fp-math should be valid. This patch changes the denormal-fp-math option to also set the f32 mode. If denormal-fp-math-f32 is also specified, this is then overridden as expected, but if it is absent floats will be set to the mode specified by the former option, rather than remain on the default. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D122589
2022-04-29[X86] Fix CodeGen Module Flag for -mibt-sealJoao Moreira1-0/+3
When assertions are enabled, clang will perform RoundTrip for CompilerInvocation argument generation. ibt-seal flags are currently missing in this argument generation, and because of that, the feature doesn't get enabled for these cases. Performing RoundTrip is the default for assert builds, rendering the feature broken in these scenarios. This patch fixes this and adds a test to properly verify that modules are being generated with the flag when -mibt-seal is used. Please, add any known relevant reviewer which I may have missed. [1] - https://reviews.llvm.org/D116070 Reviewed By: pengfei, gftg, aaron.ballman, nickdesaulniers Differential Revision: https://reviews.llvm.org/D118052
2022-04-19[misexpect] Re-implement MisExpect DiagnosticsPaul Kirth1-0/+41
Reimplements MisExpect diagnostics from D66324 to reconstruct its original checking methodology only using MD_prof branch_weights metadata. New checks rely on 2 invariants: 1) For frontend instrumentation, MD_prof branch_weights will always be populated before llvm.expect intrinsics are lowered. 2) for IR and sample profiling, llvm.expect intrinsics will always be lowered before branch_weights are populated from the IR profiles. These invariants allow the checking to assume how the existing branch weights are populated depending on the profiling method used, and emit the correct diagnostics. If these invariants are ever invalidated, the MisExpect related checks would need to be updated, potentially by re-introducing MD_misexpect metadata, and ensuring it always will be transformed the same way as branch_weights in other optimization passes. Frontend based profiling is now enabled without using LLVM Args, by introducing a new CodeGen option, and checking if the -Wmisexpect flag has been passed on the command line. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D115907
2022-04-13[Clang] Remove support for legacy pass managerNikita Popov1-9/+0
This removes the -flegacy-pass-manager and -fno-experimental-new-pass-manager options, and the corresponding support code in BackendUtil. The -fno-legacy-pass-manager and -fexperimental-new-pass-manager options are retained as no-ops. Differential Revision: https://reviews.llvm.org/D123609
2022-04-13[clang] NFC, move CompilerInvocation::setLangDefaults to LangOptions.hHaojian Wu1-173/+1
The function is moved from clangFrontend to clangBasic, which allows tools (e.g. clang pseudoparser) which don't depend on clangFrontend to use. Differential Revision: https://reviews.llvm.org/D121375
2022-04-10[Driver] Simplify -f[no-]diagnostics-color handling. NFCFangrui Song1-4/+2
Make them aliases for -f[no-]color-diagnostics.
2022-04-10[Frontend] Simplify -finline* handling. NFCFangrui Song1-17/+16
2022-04-09[randstruct] Add randomize structure layout supportConnor Kuehl1-0/+17
The Randstruct feature is a compile-time hardening technique that randomizes the field layout for designated structures of a code base. Admittedly, this is mostly useful for closed-source releases of code, since the randomization seed would need to be available for public and open source applications. Why implement it? This patch set enhances Clang’s feature parity with that of GCC which already has the Randstruct feature. It's used by the Linux kernel in certain structures to help thwart attacks that depend on structure layouts in memory. This patch set is a from-scratch reimplementation of the Randstruct feature that was originally ported to GCC. The patches for the GCC implementation can be found here: https://www.openwall.com/lists/kernel-hardening/2017/04/06/14 Link: https://lists.llvm.org/pipermail/cfe-dev/2019-March/061607.html Co-authored-by: Cole Nixon <nixontcole@gmail.com> Co-authored-by: Connor Kuehl <cipkuehl@gmail.com> Co-authored-by: James Foster <jafosterja@gmail.com> Co-authored-by: Jeff Takahashi <jeffrey.takahashi@gmail.com> Co-authored-by: Jordan Cantrell <jordan.cantrell@mail.com> Co-authored-by: Nikk Forbus <nicholas.forbus@gmail.com> Co-authored-by: Tim Pugh <nwtpugh@gmail.com> Co-authored-by: Bill Wendling <isanbard@gmail.com> Signed-off-by: Bill Wendling <isanbard@gmail.com> Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121556
2022-04-08Revert D121556 "[randstruct] Add randomize structure layout support"Fangrui Song1-17/+0
This reverts commit 3f0587d0c668202bb89d29a25432aa290e551a31. Not all tests pass after a few rounds of fixes. I spot one failure that std::shuffle (potentially different results with different STL implementations) was misused and replaced it with llvm::shuffle, but there appears to be another failure in a Windows build. The latest failure is reported on https://reviews.llvm.org/D121556#3440383
2022-04-08[randstruct] Add randomize structure layout supportConnor Kuehl1-0/+17
The Randstruct feature is a compile-time hardening technique that randomizes the field layout for designated structures of a code base. Admittedly, this is mostly useful for closed-source releases of code, since the randomization seed would need to be available for public and open source applications. Why implement it? This patch set enhances Clang’s feature parity with that of GCC which already has the Randstruct feature. It's used by the Linux kernel in certain structures to help thwart attacks that depend on structure layouts in memory. This patch set is a from-scratch reimplementation of the Randstruct feature that was originally ported to GCC. The patches for the GCC implementation can be found here: https://www.openwall.com/lists/kernel-hardening/2017/04/06/14 Link: https://lists.llvm.org/pipermail/cfe-dev/2019-March/061607.html Co-authored-by: Cole Nixon <nixontcole@gmail.com> Co-authored-by: Connor Kuehl <cipkuehl@gmail.com> Co-authored-by: James Foster <jafosterja@gmail.com> Co-authored-by: Jeff Takahashi <jeffrey.takahashi@gmail.com> Co-authored-by: Jordan Cantrell <jordan.cantrell@mail.com> Co-authored-by: Nikk Forbus <nicholas.forbus@gmail.com> Co-authored-by: Tim Pugh <nwtpugh@gmail.com> Co-authored-by: Bill Wendling <isanbard@gmail.com> Signed-off-by: Bill Wendling <isanbard@gmail.com> Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D121556
2022-04-08Clarify language option default value behavior; NFCAaron Ballman1-0/+2
The LANGOPT macro allows you to specify a default value for the langauge option. However, it's expected that these values be constant rather than depending on other language options (because the constructor setting the default values does not know the language mode at the time it's being constructed). Some of our language options were abusing this and passing in other language mode options which were then set correctly by other parts of frontend initialization. This removes the default values for the language options, and then ensures they're consistently set from the same place when setting language standard defaults.
2022-04-05Emit OpenCL metadata when targeting SPIR-VShangwu Yao1-0/+4
This is required for converting function calls such as get_global_id() into SPIR-V builtins. Differential Revision: https://reviews.llvm.org/D123049
2022-04-05In fast-math mode, when unsafe math optimizations are enabled, theZahira Ammarguellat1-0/+16
compiler is allowed to use optimizations that allow reassociation and transformations that don’t guaranty accuracy. For example (x+y)+z is transformed into x+(y+z) . Although mathematically equivalent, these two expressions may not lead to the same final result due to errors of summation. Or x/x is transformed into 1.0 but x could be 0.0, INF or NaN. And so this transformation also may not lead to the same final result. Setting the eval method 'ffp-eval-method' or via '#pragma clang fp eval_method' in this mode, doesn’t have any effect. This patch adds code to warn the user of this. Differential Revision: https://reviews.llvm.org/D122155
2022-03-31Revert "[misexpect] Re-implement MisExpect Diagnostics"Jorge Gorbe Moya1-41/+0
This reverts commit 46774df307159444d65083c2fd82f8574f0ab1d9.
2022-03-31[misexpect] Re-implement MisExpect DiagnosticsPaul Kirth1-0/+41
Reimplements MisExpect diagnostics from D66324 to reconstruct its original checking methodology only using MD_prof branch_weights metadata. New checks rely on 2 invariants: 1) For frontend instrumentation, MD_prof branch_weights will always be populated before llvm.expect intrinsics are lowered. 2) for IR and sample profiling, llvm.expect intrinsics will always be lowered before branch_weights are populated from the IR profiles. These invariants allow the checking to assume how the existing branch weights are populated depending on the profiling method used, and emit the correct diagnostics. If these invariants are ever invalidated, the MisExpect related checks would need to be updated, potentially by re-introducing MD_misexpect metadata, and ensuring it always will be transformed the same way as branch_weights in other optimization passes. Frontend based profiling is now enabled without using LLVM Args, by introducing a new CodeGen option, and checking if the -Wmisexpect flag has been passed on the command line. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D115907
2022-03-29Revert "[misexpect] Re-implement MisExpect Diagnostics"Paul Kirth1-41/+0
This reverts commit 2add3fbd976d7b80a3a7fc14ef0deb9b1ca6beee.
2022-03-28[misexpect] Re-implement MisExpect DiagnosticsPaul Kirth1-0/+41
Reimplements MisExpect diagnostics from D66324 to reconstruct its original checking methodology only using MD_prof branch_weights metadata. New checks rely on 2 invariants: 1) For frontend instrumentation, MD_prof branch_weights will always be populated before llvm.expect intrinsics are lowered. 2) for IR and sample profiling, llvm.expect intrinsics will always be lowered before branch_weights are populated from the IR profiles. These invariants allow the checking to assume how the existing branch weights are populated depending on the profiling method used, and emit the correct diagnostics. If these invariants are ever invalidated, the MisExpect related checks would need to be updated, potentially by re-introducing MD_misexpect metadata, and ensuring it always will be transformed the same way as branch_weights in other optimization passes. Frontend based profiling is now enabled without using LLVM Args, by introducing a new CodeGen option, and checking if the -Wmisexpect flag has been passed on the command line. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D115907
2022-03-28Add HLSL Language Option and PreprocessorChris Bieneman1-0/+27
Bringing in HLSL as a language as well as language options for each of the HLSL language standards. While the HLSL language is unimplemented, this patch adds the HLSL-specific preprocessor defines which enables testing of the command line options through the driver. Reviewed By: pete, rnk Differential Revision: https://reviews.llvm.org/D122087
2022-03-28[C++20][Modules][HU 5/5] Add fdirectives-only mode for preprocessing output.Iain Sandoe1-0/+3
When the -fdirectives-only option is used together with -E, the preprocessor output reflects evaluation of if/then/else directives. As such, it preserves defines and undefs of macros that are still live after such processing. The intent is that this output could be consumed as input to generate considered a C++20 header unit. We strip out any (unused) defines that come from built-in, built-in-file or command line; these are re-added when the preprocessed source is consumed. Differential Revision: https://reviews.llvm.org/D121099
2022-03-26[C++20][Modules][HU 2/5] Support searching Header Units in user or system ↵Iain Sandoe1-7/+55
search paths. This is support for the user-facing options to create importable header units from headers in the user or system search paths (or to be given an absolute path). This means that an incomplete header path will be passed by the driver and the lookup carried out using the search paths present when the front end is run. To support this, we introduce file fypes for c++-{user,system,header-unit}-header. These terms are the same as the ones used by GCC, to minimise the differences for tooling (and users). The preprocessor checks for headers before issuing a warning for "#pragma once" in a header build. We ensure that the importable header units are recognised as headers in order to avoid such warnings. Differential Revision: https://reviews.llvm.org/D121096
2022-03-26[Option] Avoid using the default argument for the 3-argument hasFlag. NFCFangrui Song1-2/+2
The default argument true is error-prone: I think many would think the default is false.
2022-03-25[C++20][Modules][HU 1/5] Introduce header units as a module type.Iain Sandoe1-1/+3
This is the first in a series of patches that introduce C++20 importable header units. These differ from clang header modules in that: (a) they are identifiable by an internal name (b) they represent the top level source for a single header - although that might include or import other headers. We name importable header units with the path by which they are specified (although that need not be the absolute path for the file). So "foo/bar.h" would have a name "foo/bar.h". Header units are made a separate module type so that we can deal with diagnosing places where they are permitted but a named module is not. Differential Revision: https://reviews.llvm.org/D121095
2022-03-18Revert "Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics"""Paul Kirth1-36/+0
This reverts commit 6cf560d69a222bff4af4e1d092437fd77f0f981c.
2022-03-18Revert "Revert "[misexpect] Re-implement MisExpect Diagnostics""Paul Kirth1-0/+36
I mistakenly reverted my commit, so I'm relanding it. This reverts commit 10866a1df4a82cdc54187330c509a2d46235455d.
2022-03-17Revert "[misexpect] Re-implement MisExpect Diagnostics"Paul Kirth1-36/+0
This reverts commit e7749d4713a5ec886011ceb0fc821c6723061724.
2022-03-17[misexpect] Re-implement MisExpect DiagnosticsPaul Kirth1-0/+36
Reimplements MisExpect diagnostics from D66324 to reconstruct its original checking methodology only using MD_prof branch_weights metadata. New checks rely on 2 invariants: 1) For frontend instrumentation, MD_prof branch_weights will always be populated before llvm.expect intrinsics are lowered. 2) for IR and sample profiling, llvm.expect intrinsics will always be lowered before branch_weights are populated from the IR profiles. These invariants allow the checking to assume how the existing branch weights are populated depending on the profiling method used, and emit the correct diagnostics. If these invariants are ever invalidated, the MisExpect related checks would need to be updated, potentially by re-introducing MD_misexpect metadata, and ensuring it always will be transformed the same way as branch_weights in other optimization passes. Frontend based profiling is now enabled without using LLVM Args, by introducing a new CodeGen option, and checking if the -Wmisexpect flag has been passed on the command line. Differential Revision: https://reviews.llvm.org/D115907
2022-03-09[clang][sema] Enable first-class bool support for C2xTimm Bäder1-2/+2
Implement N2395 for C2x. This also covers adding "bool", which is part of N2394. Differential Revision: https://reviews.llvm.org/D120244
2022-02-25[analyzer] Don't crash if the analyzer-constraint is set to Z3, but llvm is ↵Kristóf Umann1-0/+5
not built with it Exactly what it says on the tin! We had a nasty crash with the following incovation: $ clang --analyze -Xclang -analyzer-constraints=z3 test.c fatal error: error in backend: LLVM was not compiled with Z3 support, rebuild with -DLLVM_ENABLE_Z3_SOLVER=ON ... <stack trace> ... Differential Revision: https://reviews.llvm.org/D120325
2022-02-15[clang] Remove a duplicate action kind table entry.iains1-1/+0
We have two entries for OPT_emit_codegen_only in the frontend action kind table, delete one. Differential Revision: https://reviews.llvm.org/D119826
2022-02-14[X86][MS] Add 80bit long double support for WindowsPhoebe Wang1-3/+12
MSVC currently doesn't support 80 bits long double. But ICC does support it on Windows. Besides, there're also some users asked for this feature. We can find the discussions from stackoverflow, msdn etc. Given Clang has already support `-mlong-double-80`, extending it to support for Windows seems worthwhile. Reviewed By: rnk, erichkeane Differential Revision: https://reviews.llvm.org/D115441
2022-02-04[OpenMP] Completely remove old device runtimeJoseph Huber1-15/+5
This patch completely removes the old OpenMP device runtime. Previously, the old runtime had the prefix `libomptarget-new-` and the old runtime was simply called `libomptarget-`. This patch makes the formerly new runtime the only runtime available. The entire project has been deleted, and all references to the `libomptarget-new` runtime has been replaced with `libomptarget-`. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D118934
2022-02-02[clang][macho] add clang frontend support for emitting macho files with two ↵Alex Lorenz1-0/+12
build version load commands This patch extends clang frontend to add metadata that can be used to emit macho files with two build version load commands. It utilizes "darwin.target_variant.triple" and "darwin.target_variant.SDK Version" metadata names for that. MachO uses two build version load commands to represent an object file / binary that is targeting both the macOS target, and the Mac Catalyst target. At runtime, a dynamic library that supports both targets can be loaded from either a native macOS or a Mac Catalyst app on a macOS system. We want to add support to this to upstream to LLVM to be able to build compiler-rt for both targets, to finish the complete support for the Mac Catalyst platform, which is right now targetable by upstream clang, but the compiler-rt bits aren't supported because of the lack of this multiple build version support. Differential Revision: https://reviews.llvm.org/D115415
2022-01-28GCC ABI Compatibility: Preserve alignment of non-pod members in packed structsDavid Blaikie1-0/+4
This matches GCC: https://godbolt.org/z/sM5q95PGY I realize this is an API break for clang+clang - so I'm totally open to discussing how we should deal with that. If Apple wants to keep the Clang layout indefinitely, if we want to put a flag on this so non-Apple folks can opt out of this fix/new behavior. Differential Revision: https://reviews.llvm.org/D117616
2022-01-26[clang] Add an extract-api driver optionZixu Wang1-0/+2
This is the initial commit for the clang-extract-api RFC <https://lists.llvm.org/pipermail/cfe-dev/2021-September/068768.html> Add a new driver option `-extract-api` and associate it with a dummy (for now) frontend action to set up the initial structure for incremental works. Differential Revision: https://reviews.llvm.org/D117809
2022-01-21[X86] Enable ibt-seal optimization when LTO is used in KernelJoao Moreira1-0/+3
Intel's CET/IBT requires every indirect branch target to be an ENDBR instruction. Because of that, the compiler needs to correctly emit these instruction on function's prologues. Because this is a security feature, it is desirable that only actual indirect-branch-targeted functions are emitted with ENDBRs. While it is possible to identify address-taken functions through LTO, minimizing these ENDBR instructions remains a hard task for user-space binaries because exported functions may end being reachable through PLT entries, that will use an indirect branch for such. Because this cannot be determined during compilation-time, the compiler currently emits ENDBRs to every non-local-linkage function. Despite the challenge presented for user-space, the kernel landscape is different as no PLTs are used. With the intent of providing the most fit ENDBR emission for the kernel, kernel developers proposed an optimization named "ibt-seal" which replaces the ENDBRs for NOPs directly in the binary. The discussion of this feature can be seen in [1]. This diff brings the enablement of the flag -mibt-seal, which in combination with LTO enforces a different policy for ENDBR placement in when the code-model is set to "kernel". In this scenario, the compiler will only emit ENDBRs to address taken functions, ignoring non-address taken functions that are don't have local linkage. A comparison between an LTO-compiled kernel binaries without and with the -mibt-seal feature enabled shows that when -mibt-seal was used, the number of ENDBRs in the vmlinux.o binary patched by objtool decreased from 44383 to 33192, and that the number of superfluous ENDBR instructions nopped-out decreased from 11730 to 540. The 540 missed superfluous ENDBRs need to be investigated further, but hypotheses are: assembly code not being taken care of by the compiler, kernel exported symbols mechanisms creating bogus address taken situations or even these being removed due to other binary optimizations like kernel's static_calls. For now, I assume that the large drop in the number of ENDBR instructions already justifies the feature being merged. [1] - https://lkml.org/lkml/2021/11/22/591 Reviewed By: xiangzhangllvm Differential Revision: https://reviews.llvm.org/D116070
2021-12-28Drop unnecessary const from return types (NFC)Kazu Hirata1-2/+2
Identified with readability-const-return-type.
2021-12-21[Clang] Own the CommandLineArgs in CodeGenOptionsAlexandre Ganea1-1/+1
Fixes PR52704 : https://github.com/llvm/llvm-project/issues/52704 Differential Revision: https://reviews.llvm.org/D116011
2021-12-17[clang] Strip redundant lambda (NFC)Kazu Hirata1-3/+1
2021-12-09[NFC][clang] Return underlying strings directly instead of OS.str()Logan Smith1-1/+1
This avoids an unnecessary copy required by 'return OS.str()', allowing instead for NRVO or implicit move. The .str() call (which flushes the stream) is no longer required since 65b13610a5226b84889b923bae884ba395ad084d, which made raw_string_ostream unbuffered by default. Differential Revision: https://reviews.llvm.org/D115374
2021-12-07[IR] Remove unbounded as possible value for vscale_range minimumCullen Rhodes1-0/+7
The default for min is changed to 1. The behaviour of -mvscale-{min,max} in Clang is also changed such that 16 is the max vscale when targeting SVE and no max is specified. Reviewed By: sdesmalen, paulwalker-arm Differential Revision: https://reviews.llvm.org/D113294
2021-11-18[clang] Remove CLANG_ROUND_TRIP_CC1_ARGS and always roundtrip in +assert buildsNico Weber1-5/+3
This removes the ability to disable roundtripping in assert builds. (Roundtripping happens by default in assert builds both before and after this patch.) The CLANG_ROUND_TRIP_CC1_ARGS was added as an escape hatch 9 months ago in https://reviews.llvm.org/D97462, with a FIXME to remove it eventually. It's probably time to remove it. Differential Revision: https://reviews.llvm.org/D114120
2021-11-17[clang] Try to fix test more after ae98182cf7341181eNico Weber1-12/+0
We need to use the td-based marshalling instead of doing this manually, else the setting gets lost on the way to codegen in most build configs.
2021-11-17[clang] Make -masm=intel affect inline asm styleNico Weber1-0/+12
With this, void f() { __asm__("mov eax, ebx"); } now compiles with clang with -masm=intel. This matches gcc. The flag is not accepted in clang-cl mode. It has no effect on MSVC-style `__asm {}` blocks, which are unconditionally in intel mode both before and after this change. One difference to gcc is that in clang, inline asm strings are "local" while they're "global" in gcc. Building the following with -masm=intel works with clang, but not with gcc where the ".att_syntax" from the 2nd __asm__() is in effect until file end (or until a ".intel_syntax" somewhere later in the file): __asm__("mov eax, ebx"); __asm__(".att_syntax\nmovl %ebx, %eax"); __asm__("mov eax, ebx"); This also updates clang's intrinsic headers to work both in -masm=att (the default) and -masm=intel modes. The official solution for this according to "Multiple assembler dialects in asm templates" in gcc docs->Extensions->Inline Assembly->Extended Asm is to write every inline asm snippet twice: bt{l %[Offset],%[Base] | %[Base],%[Offset]} This works in LLVM after D113932 and D113894, so use that. (Just putting `.att_syntax` at the start of the snippet works in some but not all cases: When LLVM interpolates in parameters like `%0`, it uses at&t or intel syntax according to the inline asm snippet's flavor, so the `.att_syntax` within the snippet happens to late: The interpolated-in parameter is already in intel style, and then won't parse in the switched `.att_syntax`.) It might be nice to invent a `#pragma clang asm_dialect push "att"` / `#pragma clang asm_dialect pop` to be able to force asm style per snippet, so that the inline asm string doesn't contain the same code in two variants, but let's leave that for a follow-up. Fixes PR21401 and PR20241. Differential Revision: https://reviews.llvm.org/D113707
2021-10-19[Driver, Frontend] Use StringRef::contains (NFC)Kazu Hirata1-6/+6