summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* InstrProf: Support for setting profile output from command lineJustin Bogner2015-04-301-1/+3
| | | | | | | | | | | | | | | | This change is the third of 3 patches to add support for specifying the profile output from the command line via -fprofile-instr-generate=<path>, where the specified output path/file will be overridden by the LLVM_PROFILE_FILE environment variable. This patch adds the necessary support to the clang frontend, and adds a new test. The compiler-rt and llvm parts are r236055 and r236288, respectively. Patch by Teresa Johnson. Thanks! llvm-svn: 236289
* Support generating NMake/Jom-style depfiles.Paul Robinson2015-04-271-0/+2
| | | | | | | | | | | | | | | NMake is a Make-like builder that comes with Microsoft Visual Studio. Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool. Dependency files for NMake/Jom need to use double-quotes to wrap filespecs containing special characters, instead of the backslash escapes that GNU Make wants. Adds the -MV option, which specifies to use double-quotes as needed instead of backslash escapes when writing the dependency file. Differential Revision: http://reviews.llvm.org/D9260 llvm-svn: 235903
* Create a frontend flag to disable CUDA cross-target call checksEli Bendersky2015-04-151-0/+3
| | | | | | | | | | | | | | | For CUDA source, Sema checks that the targets of call expressions make sense (e.g. a host function can't call a device function). Adding a flag that lets us skip this check. Motivation: for source-to-source translation tools that have to accept code that's not strictly kosher CUDA but is still accepted by nvcc. The source-to-source translation tool can then fix the code and leave calls that are semantically valid for the actual compilation stage. Differential Revision: http://reviews.llvm.org/D9036 llvm-svn: 235049
* uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith2015-04-151-0/+4
| | | | | | | | | | | | | | | Stop relying on `cl::opt` to pass along the driver's decision to preserve use-lists. Create a new `-cc1` option called `-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc). Note that despite its generic name, it *doesn't* do the right thing when -emit-llvm (LLVM assembly) yet. I'll hook that up soon. This doesn't really change the behaviour of the driver. The default is still to preserve use-lists for `clang -emit-llvm` and `clang -save-temps`, and nothing else. But it stops relying on global state (and also is a nicer interface for hackers using `clang -cc1`). llvm-svn: 234962
* [Driver] Properly support -mglobal-merge using explicit options.Ahmed Bougacha2015-04-111-1/+0
| | | | | | | | Follow-up to r234666. With this, the -m[no-]global-merge options have the expected behavior. Previously, -mglobal-merge was ignored, and there was no way of enabling the optimization. llvm-svn: 234668
* Process the -freciprocal-math optimization flag (PR20912)Sanjay Patel2015-04-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The driver currently accepts but ignores the -freciprocal-math flag. This patch passes the flag through and enables 'arcp' fast-math-flag generation in IR. Note that this change does not actually enable the optimization for any target. The reassociation optimization that this flag specifies was implemented by http://reviews.llvm.org/D6334 : http://llvm.org/viewvc/llvm-project?view=revision&revision=222510 Because the optimization is done in the backend rather than IR, the backend must be modified to understand instruction-level fast-math-flags or a new function-level attribute must be created. Also note that -freciprocal-math is independent of any target-specific usage of reciprocal estimate hardware instructions. That requires its own flag ('-mrecip'). https://llvm.org/bugs/show_bug.cgi?id=20912 llvm-svn: 234493
* MS ABI: Implement driver-level support for thread-safe staticsDavid Majnemer2015-03-221-38/+10
| | | | | | | | | | | Decide whether or not to use thread-safe statics depending on whether or not we have an explicit request from the driver. If we don't have an explicit request, infer which behavior to use depending on the compatibility version we are targeting. N.B. CodeGen support is still ongoing. llvm-svn: 232906
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 llvm-svn: 232788
* Remove .CUDAIsDevice flags from CodeGenOpts as it's alreadyArtem Belevich2015-03-191-1/+0
| | | | | | | | available in LangOpts. Differential Revision: http://reviews.llvm.org/D8385 llvm-svn: 232749
* Ensure that we still parse preprocessed CUDA files as CUDA when we useArtem Belevich2015-03-191-1/+5
| | | | | | | | | -save-temps option. Summary: Fixes PR22926. Review: http://reviews.llvm.org/D8383 llvm-svn: 232737
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-1/+1
| | | | | | | | | | | | | | | Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
* Add fveclib option.Michael Zolotukhin2015-03-171-0/+10
| | | | | Review: http://reviews.llvm.org/D8097 llvm-svn: 232533
* GCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1Justin Bogner2015-03-161-0/+2
| | | | | | | | | This exposes the optional exit block placement logic from r232438 as a clang -cc1 option. There is a test on the llvm side, but there isn't really a way to inspect the gcov options from clang to test it here as well. llvm-svn: 232439
* Add clang support for Objective-C application extensions.Bob Wilson2015-03-021-0/+1
| | | | | | | | This adds the -fapplication-extension option, along with the ios_app_extension and macosx_app_extension availability attributes. Patch by Ted Kremenek llvm-svn: 230989
* Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner2015-02-261-0/+1
| | | | | | | | | | | | | | | | | | Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
* CUDA: Add option to allow host device functions to call host functionsJacques Pienaar2015-02-241-1/+4
| | | | | | Commiting code from review http://reviews.llvm.org/D7841 llvm-svn: 230385
* Add -funique-section-names and -fno-unique-section-names options.Rafael Espindola2015-02-201-0/+3
| | | | | | | | | For now -funique-section-names is the default, so no change in default behavior. The total .o size in a build of llvm and clang goes from 241687775 to 230649031 bytes if -fno-unique-section-names is used. llvm-svn: 230031
* Add -fno-implicit-modules.Manuel Klimek2015-02-201-0/+1
| | | | | | | If this flag is set, we error out when a module build is required. This is useful in environments where all required modules are passed via -fmodule-file. llvm-svn: 230006
* Add -fno-sized-deallocation option for completeness of fix in r229241 in ↵Larisse Voufo2015-02-201-0/+1
| | | | | | documentation in r229818. llvm-svn: 229950
* Revert adding hostname to module hashBen Langmuir2015-02-191-17/+0
| | | | | | | | | | | | I didn't realize how easily the hostname could change - for example just changing wireless networks seems to prompt it in some cases. Users can always set their own local module cache path to avoid this. This reverts commits r228592, 228594, 228601 and 228613. rdar://19287368 llvm-svn: 229815
* Rename flags and options to match current naming: from -fdef-sized-delete to ↵Larisse Voufo2015-02-181-2/+2
| | | | | | -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation. llvm-svn: 229597
* Revise the implementation logic of sized deallocation: Do not automatically ↵Larisse Voufo2015-02-141-0/+2
| | | | | | | | generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete. The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table. llvm-svn: 229241
* Revert "Revert r229082 for a bit, it caused PR22577."David Majnemer2015-02-141-0/+2
| | | | | | | This reverts commit r229123. It was a red herring, the bug was present without r229082. llvm-svn: 229205
* Revert r229082 for a bit, it caused PR22577.Nico Weber2015-02-131-2/+0
| | | | llvm-svn: 229123
* MS ABI: Implement /volatile:msDavid Majnemer2015-02-131-0/+2
| | | | | | | | | | | | The /volatile:ms semantics turn volatile loads and stores into atomic acquire and release operations. This distinction is important because volatile memory operations do not form a happens-before relationship with non-atomic memory. This means that a volatile store is not sufficient for implementing a mutex unlock routine. Differential Revision: http://reviews.llvm.org/D7580 llvm-svn: 229082
* Be more conservative about gethostname()'s truncating behaviourBen Langmuir2015-02-091-1/+5
| | | | | | | | Don't assume it will provide an error or null-terminate the string on truncation, since POSIX doesn't guarantee either behaviour (although Linux and Darwin at least will do the 'right thing'). llvm-svn: 228613
* Update r228592 for when gethostname() returns an errorBen Langmuir2015-02-091-3/+3
| | | | | | | | | If gethostname() is not successful, just skip adding the hostname to the module hash. And don't bother setting hostname[255] = 0, since if gethostname() is successful, it will be null-terminated already (and if it's not successful we don't read the string now. llvm-svn: 228601
* Add missing include from r228592Ben Langmuir2015-02-091-0/+3
| | | | llvm-svn: 228594
* Add the hostname to the module hash to avoid sharing between hostsBen Langmuir2015-02-091-0/+10
| | | | | | | Sharing between hosts will cause problems for the LockFileManager, which can timeout waiting for a process that has already died. llvm-svn: 228592
* Allow to specify multiple -fsanitize-blacklist= arguments.Alexey Samsonov2015-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Allow user to provide multiple blacklists by passing several -fsanitize-blacklist= options. These options now don't override default blacklist from Clang resource directory, which is always applied (which fixes PR22431). -fno-sanitize-blacklist option now disables all blacklists that were specified earlier in the command line (including the default one). This change depends on http://reviews.llvm.org/D7367. Test Plan: regression test suite Reviewers: timurrrr Subscribers: cfe-commits, kcc, pcc Differential Revision: http://reviews.llvm.org/D7368 llvm-svn: 228156
* Add cc1 option '-fmodule-feature' to add custom values for 'requires' declsBen Langmuir2015-02-021-0/+1
| | | | | | | This allows clang-based tools to specify custom features that can be tested by the 'requires' declaration in a module map file. llvm-svn: 227868
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-021-2/+2
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. llvm-svn: 227842
* Process the -fno-signed-zeros optimization flag (PR20870)Sanjay Patel2015-01-231-1/+1
| | | | | | | | | | | | | | | | | | The driver currently accepts but ignores the -fno-signed-zeros flag. This patch passes the flag through and enables 'nsz' fast-math-flag generation in IR. The existing OpenCL flag for the same functionality is made into an alias here. It may be removed in a subsequent patch. This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 ); patches for the optimizer were checked in at: http://llvm.org/viewvc/llvm-project?view=revision&revision=225050 http://llvm.org/viewvc/llvm-project?view=revision&revision=224583 Differential Revision: http://reviews.llvm.org/D6873 llvm-svn: 226915
* Implement command line options for stack probe spaceHans Wennborg2015-01-201-0/+7
| | | | | | | | | | | | | This code adds the -mstack-probe-size command line option and implements the /Gs compiler switch for clang-cl. This should fix http://llvm.org/bugs/show_bug.cgi?id=21896 Patch by Andrew H! Differential Revision: http://reviews.llvm.org/D6685 llvm-svn: 226601
* Adding option -fno-inline-asm to disallow inline asmSteven Wu2015-01-161-0/+1
| | | | | | | | | | | | | | | | Summary: This patch add a new option to dis-allow all inline asm. Any GCC style inline asm will be reported as an error. Reviewers: rnk, echristo Reviewed By: rnk, echristo Subscribers: bob.wilson, rnk, echristo, rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D6870 llvm-svn: 226340
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Revert "Insert random noops to increase security against ROP attacks (clang)"JF Bastien2015-01-141-1/+0
| | | | | | | This reverts commit: http://reviews.llvm.org/D3393 llvm-svn: 225947
* Insert random noops to increase security against ROP attacks (clang)JF Bastien2015-01-141-0/+1
| | | | | | | | | | | | | | | | | | | | A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks. Command line options: -noop-insertion // Enable noop insertion. -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion) -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions. In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future). -fdiversify This is the clang part of the patch. llvm part: D3392 http://reviews.llvm.org/D3393 Patch by Stephen Crane (@rinon) llvm-svn: 225910
* Reimplement -fsanitize-recover family of flags.Alexey Samsonov2015-01-121-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | Introduce the following -fsanitize-recover flags: - -fsanitize-recover=<list>: Enable recovery for selected checks or group of checks. It is forbidden to explicitly list unrecoverable sanitizers here (that is, "address", "unreachable", "return"). - -fno-sanitize-recover=<list>: Disable recovery for selected checks or group of checks. - -f(no-)?sanitize-recover is now a synonym for -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated. These flags are parsed left to right, and mask of "recoverable" sanitizer is updated accordingly, much like what we do for -fsanitize= flags. -fsanitize= and -fsanitize-recover= flag families are independent. CodeGen change: If there is a single UBSan handler function, responsible for implementing multiple checks, which have different recoverable setting, then we emit two handler calls instead of one: the first one for the set of "unrecoverable" checks, another one - for set of "recoverable" checks. If all checks implemented by a handler have the same recoverability setting, then the generated code will be the same. llvm-svn: 225719
* Driver: begin threading frontend support for SymbolRewriterSaleem Abdulrasool2015-01-091-0/+2
| | | | | | | | | | Allow blessed access to the symbol rewriter from the driver. Although the symbol rewriter could be invoked through tools like opt and llc, it would not accessible from the frontend. This allows us to read the rewrite map files in the frontend rather than the backend and enable symbol rewriting for actually performing the symbol interpositioning. llvm-svn: 225504
* Fix use-after-destruction introduced in r224924.Alexey Samsonov2014-12-291-1/+2
| | | | | | | | getMainExecutable() returns a std::string, assigning its result to StringRef immediately creates a dangling pointer. This was detected by half-broken fast-MSan-bootstrap bot. llvm-svn: 224956
* [multilib] Teach Clang's code about multilib by threadingChandler Carruth2014-12-291-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a CLANG_LIBDIR_SUFFIX down from the build system and using that as part of the default resource dir computation. Without this, essentially nothing that uses the clang driver works when building clang with a libdir suffix. This is probably the single biggest missing piece of support for multilib as without this people could hack clang to end up installed in the correct location, but it would then fail to find its own basic resources. I know of at least one distro that has some variation on this patch to hack around this; hopefully they'll be able to use the libdir suffix functionality directly as the rest of these bits land. This required fixing a copy of the code to compute Clang's resource directory that is buried inside of the frontend (!!!). It had bitrotted significantly relative to the driver code. I've made it essentially a clone of the driver code in order to keep tests (which use cc1 heavily) passing. This copy should probably just be removed and the frontend taught to always rely on an explicit resource directory from the driver, but that is a much more invasive change for another day. I've also updated one test which actually encoded the resource directory in its checked output to tolerate multilib suffixes. Note that this relies on a prior LLVM commit to add a stub to the autoconf build system for this variable. llvm-svn: 224924
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-231-2/+2
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* Disable trigraphs in microsoft mode by default. Matches cl.exe.Nico Weber2014-12-221-9/+9
| | | | | | | | | | The default value of Opts.Trigraphs now no longer depends solely on the language input kind, so move the code out of setLangDefaults(). Also make sure that Opts.MSVCCompat is set before the Trigraph code runs. Related to PR21974. llvm-svn: 224719
* Fix handling of invalid -O options.Rafael Espindola2014-12-161-4/+6
| | | | | | | | We were checking the value after truncating it to a bitfield. Thanks to Yunzhong Gao for noticing it. llvm-svn: 224378
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-161-0/+3
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* OpenCL C: Add support for a set of floating point Pekka Jaaskelainen2014-12-101-4/+9
| | | | | | | | | | | | | | arithmetic relaxation flags: -cl-no-signed-zeros -cl-unsafe-math-optimizations -cl-finite-math-only -cl-fast-relaxed-math Propagate the info to FP instruction flags as well as function attributes where they are available. llvm-svn: 223928
* Reinstate r223753, reverted in r223759 due to breakage of clang-tools-extra.Richard Smith2014-12-101-0/+1
| | | | | | | | | | | | | | | | | Original commit message: [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1. For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223913
* Revert "[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1."Duncan P. N. Exon Smith2014-12-091-1/+0
| | | | | | | | | | | | | This reverts commit r223753. It broke the Green Dragon build for a few hours: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/ http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/consoleFull#43901905849ba4694-19c4-4d7e-bec5-911270d8a58c I suspect `clang-tools-extra` just needs a follow-up for an API change, but I'm not the right one to look into it. llvm-svn: 223759
* [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1.Richard Smith2014-12-091-0/+1
| | | | | | | | | | | | | For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223753
OpenPOWER on IntegriCloud