summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Adapt to llvm NamedRegionTimer changesMatthias Braun2016-11-181-5/+10
| | | | | | We have to specify a name and description for the timers and groups now. llvm-svn: 287371
* [CUDA] Initialize our header search using the host triple.Justin Lebar2016-11-181-2/+9
| | | | | | | | | | | | | | | | Summary: This used to work because system headers are found in a (somewhat) predictable set of locations on Linux. But this is not the case on MacOS; without this change, we don't look in the right places for our headers when doing device-side compilation on Mac. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26776 llvm-svn: 287286
* [Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2016-11-172-8/+27
| | | | | | | | | | | | | | | | | Re-introduce r285411. Implement the -dI as supported by GCC: Output ‘#include’ directives in addition to the result of preprocessing. This change aims to add this option, pass it through to the preprocessor via the options class, and when inclusions occur we output some information (+ test cases). Patch by Steve O'Brien! Differential Revision: https://reviews.llvm.org/D26089 llvm-svn: 287275
* Rangify for loops, NFC.Yaron Keren2016-11-161-11/+8
| | | | llvm-svn: 287138
* [Frontend] Allow attaching an external sema source to compiler instance and ↵Benjamin Kramer2016-11-161-0/+10
| | | | | | | | | | | extra diags to TypoCorrections This can be used to append alternative typo corrections to an existing diag. include-fixer can use it to suggest includes to be added. Differential Revision: https://reviews.llvm.org/D26745 llvm-svn: 287128
* Add a new optimization option -Og Sylvestre Ledru2016-11-111-0/+3
| | | | | | | | | | | | | | Summary: Just like gcc, we should have the -Og option as more and more software are using it: https://llvm.org/bugs/show_bug.cgi?id=20765 Reviewers: echristo, dberlin, dblaikie, keith.walker.arm, rengolin Subscribers: aprantl, friss, mehdi_amini, RKSimon, probinson, majnemer, cfe-commits Differential Revision: https://reviews.llvm.org/D24998 llvm-svn: 286602
* [VFS] Replace TimeValue usage with std::chronoPavel Labath2016-11-091-3/+4
| | | | | | | | | | | | Summary: NFCI Reviewers: benlangmuir, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25948 llvm-svn: 286356
* Bitcode: Decouple block info block state from reader.Peter Collingbourne2016-11-082-7/+10
| | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html Move block info block state to a new class, BitstreamBlockInfo. Clients may set the block info for a particular cursor with the BitstreamCursor::setBlockInfo() method. At this point BitstreamReader is not much more than a container for an ArrayRef<uint8_t>, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 llvm-svn: 286207
* Instead of resetting the pointer, or releasing it which was the previousChandler Carruth2016-11-031-1/+2
| | | | | | | | | | | | code, let's just assert that the DiagonsticEngine doesn't own the client because our constructor took ownership of it and has a std::unique_ptr that handles deleting it. This seems much more clear -- the release was harmless but confusing as if there were some memory there it would have leaked, and the reset was harmless but confusing as if there were some memory there it would have been double-freed. But in both cases there was nothing there. llvm-svn: 285950
* Using release to free memory is at best confusing -- one would expectChandler Carruth2016-11-031-1/+1
| | | | | | | | that its result is in fact used. Instead, use reset. This was pointed out by PVS-Studio. llvm-svn: 285946
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-023-25/+19
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* Bitcode: Change reader interface to take memory buffers.Peter Collingbourne2016-11-022-6/+2
| | | | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106595.html This change also fixes an API oddity where BitstreamCursor::Read() would return zero for the first read past the end of the bitstream, but would report_fatal_error for subsequent reads. Now we always report_fatal_error for all reads past the end. Updated clients to check for the end of the bitstream before reading from it. I also needed to add padding to the invalid bitcode tests in test/Bitcode/. This is because the streaming interface was not checking that the file size is a multiple of 4. Differential Revision: https://reviews.llvm.org/D26219 llvm-svn: 285773
* [OpenCL] Override supported OpenCL extensions with -cl-ext optionAlexey Bader2016-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a command line option '-cl-ext' to control a set of supported OpenCL extensions. Option accepts a comma-separated list of extensions prefixed with '+' or '-'. It can be used together with a target triple to override support for some extensions: // spir target supports all extensions, but we want to disable fp64 clang -cc1 -triple spir-unknown-unknown -cl-ext=-cl_khr_fp64 Special 'all' extension allows to enable or disable all possible extensions: // only fp64 will be supported clang -cc1 -triple spir-unknown-unknown -cl-ext=-all,+cl_khr_fp64 Patch by asavonic (Andrew Savonichev). Reviewers: joey, yaxunl Subscribers: yaxunl, bader, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D23712 llvm-svn: 285700
* Implement ABI proposal for throwing noexcept function pointers, per discussionRichard Smith2016-11-011-0/+1
| | | | | | | | on cxx-abi-dev (thread starting 2016-10-11). This is currently hidden behind a cc1-only -m flag, pending discussion of how best to deal with language changes that require use of new symbols from the ABI library. llvm-svn: 285664
* Bitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.Peter Collingbourne2016-11-011-1/+1
| | | | | | | | | | | No block info block should need to define local abbreviations, so we can always use a code width of 2. Also change all block info block writers to use EnterBlockInfoBlock. Differential Revision: https://reviews.llvm.org/D26168 llvm-svn: 285660
* Add comment explaining this mysterious macro name.Richard Smith2016-10-311-0/+3
| | | | llvm-svn: 285631
* Revert "[Preprocessor] Support for '-dI' flag"Bruno Cardoso Lopes2016-10-282-27/+8
| | | | | | | This reverts r285411. Tests failing on http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141 llvm-svn: 285416
* [Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2016-10-282-8/+27
| | | | | | | | | | | | | | | Implement the -dI as supported by GCC: Output ‘#include’ directives in addition to the result of preprocessing. This change aims to add this option, pass it through to the preprocessor via the options class, and when inclusions occur we output some information (+ test cases). Patch by Steve O'Brien! Differential Revision: https://reviews.llvm.org/D25153 llvm-svn: 285411
* Do not print include_next/pragma once warnings when input is a header.Erik Verbruggen2016-10-271-2/+11
| | | | | | | | | | | r276653 suppressed the pragma once warning when generating a PCH file. This patch extends that to any main file for which clang is told (with the -x option) that it's a header file. It will also suppress the warning "#include_next in primary source file". Differential Revision: http://reviews.llvm.org/D25989 llvm-svn: 285295
* Switch SmallSetVector to use DenseSet when it overflows its inline space.Justin Lebar2016-10-212-3/+6
| | | | | | | | | | | | | | | | | | | | Summary: SetVector already used DenseSet, but SmallSetVector used std::set. This leads to surprising performance differences. Moreover, it means that the set of key types accepted by SetVector and SmallSetVector are quite different! In order to make this change, we had to convert some callsites that used SmallSetVector<std::string, N> to use SmallSetVector<CachedHashString, N> instead. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25648 llvm-svn: 284887
* Use noexcept instead of LLVM_NOEXCEPT now that all compilers support itReid Kleckner2016-10-191-1/+1
| | | | llvm-svn: 284667
* New clang option -mpie-copy-relocations to use copy relocations for PIE builds.Sriraman Tallam2016-10-191-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D19996 llvm-svn: 284638
* Reapply [Driver][Diagnostics] Make 'show option names' default for driver ↵Bruno Cardoso Lopes2016-10-111-4/+7
| | | | | | | | | | | | | | | | | | warnings Reapply r283827 by fixing the tests to not be target specific Currently, driver level warnings do not show option names (e.g. warning: complain about foo [-Woption-name]) in a diagnostic unless -fdiagnostics-show-option is explictly specified. OTOH, the driver by default turn this option on for CC1. Change the logic to show option names by default in the driver as well. Differential Revision: https://reviews.llvm.org/D24516 rdar://problem/27300909 llvm-svn: 283913
* Fix the build with MSVC 2013 after r283856Reid Kleckner2016-10-111-4/+8
| | | | llvm-svn: 283906
* Revert "[Driver][Diagnostics] Make 'show option names' default for driver ↵Renato Golin2016-10-111-7/+4
| | | | | | | | warnings" This reverts commit r283827, as it's breaking all ARM/AARch64 bots. llvm-svn: 283868
* Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini2016-10-111-6/+9
| | | | llvm-svn: 283856
* Add an option to save the backend-produced YAML optimization record to a fileHal Finkel2016-10-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The backend now has the capability to save information from optimizations, the same information that can be used to generate optimization diagnostics but in machine-consumable form, into an output file. This can be enabled when using opt (see r282539), and this change enables it when using clang. The idea is that other tools will be able to consume these files, and perhaps in combination with the original source code, produce various kinds of optimization reports for users (and for compiler developers). We now have at-least two tools that can consume these files: * tools/llvm-opt-report * utils/opt-viewer Using the flag -fsave-optimization-record will cause the YAML file to be generated; the file name will be based on the output file name (if we're using -c or -S and have an output name), or the input file name. When we're using CUDA, or some other offloading mechanism, separate files are generated for each backend target. The output file name can be specified by the user using -foptimization-record-file=filename. Differential Revision: https://reviews.llvm.org/D25225 llvm-svn: 283834
* [Driver][Diagnostics] Make 'show option names' default for driver warningsBruno Cardoso Lopes2016-10-111-4/+7
| | | | | | | | | | | | | | Currently, driver level warnings do not show option names (e.g. warning: complain about foo [-Woption-name]) in a diagnostic unless -fdiagnostics-show-option is explictly specified. OTOH, the driver by default turn this option on for CC1. Change the logic to show option names by default in the driver as well. Differential Revision: https://reviews.llvm.org/D24516 rdar://problem/27300909 llvm-svn: 283827
* Add -fno-sanitize-address-use-after-scope flagVitaly Buka2016-10-101-2/+5
| | | | | | | | Reviewers: eugenis Differential Revision: https://reviews.llvm.org/D25453 llvm-svn: 283801
* Mark aligned allocation as done.Richard Smith2016-10-101-1/+2
| | | | llvm-svn: 283724
* [CUDA] Rename cuda_builtin_vars.h to __clang_cuda_builtin_vars.h.Justin Lebar2016-10-081-3/+4
| | | | | | | | | | | | Summary: This matches the idiom we use for our other CUDA wrapper headers. Reviewers: tra Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24978 llvm-svn: 283679
* [coroutines] Rename driver flag -fcoroutines to -fcoroutines-tsGor Nishanov2016-10-022-2/+2
| | | | | | | | | | | | | | | Summary: Also makes -fcoroutines_ts to be both a Driver and CC1 flag. Patch mostly by EricWF. Reviewers: rnk, cfe-commits, rsmith, EricWF Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D25130 llvm-svn: 283064
* Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini2016-10-013-5/+5
| | | | llvm-svn: 283043
* P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, weRichard Smith2016-09-302-0/+22
| | | | | | | | | assume that ::operator new provides no more alignment than is necessary for any primitive type, except when we're on a GNU OS, where glibc's malloc guarantees to provide 64-bit alignment on 32-bit systems and 128-bit alignment on 64-bit systems. This can be controlled by the command-line -fnew-alignment flag. llvm-svn: 282974
* Move UTF functions into namespace llvm.Justin Lebar2016-09-301-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This lets people link against LLVM and their own version of the UTF library. I determined this only affects llvm, clang, lld, and lldb by running $ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq clang lld lldb llvm Tested with ninja lldb ninja check-clang check-llvm check-lld (ninja check-lldb doesn't complete for me with or without this patch.) Reviewers: rnk Subscribers: klimek, beanz, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D24996 llvm-svn: 282822
* Mark P0127R3 as done, and replace its __has_feature check with the ↵Richard Smith2016-09-291-1/+1
| | | | | | corresponding SD-6 macro. llvm-svn: 282652
* Add a couple more tentative names for upcoming SD-6 feature checks. These mightRichard Smith2016-09-281-0/+4
| | | | | | | not reflect the final chosen names, but supporting them now seems to have little downside. llvm-svn: 282629
* P0095R3: Implement the latest published revision of SD-6 (C++ feature test ↵Richard Smith2016-09-281-2/+6
| | | | | | macros). llvm-svn: 282627
* P0096R2: Implement more recent revision of SD-6 (C++ feature test macros).Richard Smith2016-09-281-2/+15
| | | | llvm-svn: 282622
* Adapt to LLVM EnableStatistics() change.Matthias Braun2016-09-271-1/+1
| | | | llvm-svn: 282533
* CC1: Add -save-stats optionMatthias Braun2016-09-262-4/+20
| | | | | | | | | This option behaves in a similar spirit as -save-temps and writes internal llvm statistics in json format to a file. Differential Revision: https://reviews.llvm.org/D24820 llvm-svn: 282426
* Revert "set the underlying value of “#pragma STDC FP_CONTRACT” on by ↵Renato Golin2016-09-231-6/+0
| | | | | | | | default" This reverts commit r282259, as it broke the AArch64 test-suite bots. llvm-svn: 282289
* set the underlying value of “#pragma STDC FP_CONTRACT” on by defaultSebastian Pop2016-09-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang has the default FP contraction setting of “-ffp-contract=on”, which doesn't really mean “on” in the conventional sense of the word, but rather really means “according to the per-statement effective value of the relevant pragma”. Before this patch, Clang has that pragma defaulting to “off”. Since the “-ffp-contract=on” mode is really an AND of two booleans and the second of them defaults to “off”, the whole thing effectively defaults to “off”. This patch changes the default value of the pragma to “on”, thus making the default pair of booleans (on, on) rather than (on, off). This makes FP optimization slightly more aggressive than before when not using either “-Ofast”, “-ffast-math”, or “-ffp-contract=fast”. Even with this patch the compiler still respects “-ffp-contract=off”. As per a suggestion by Steve Canon, the added code does _not_ require “-O3” or higher. This is so as to try our best to preserve identical floating-point results for unchanged source code compiling for an unchanged target when only changing from any optimization level in the set (“-O0”, “-O1”, “-O2”, “-O3”) to any other optimization level in that set. “-Os” and “-Oz” seem to be behaving identically, i.e. should probably be considered a part of the aforementioned set, but I have not reviewed this rigorously. “-Ofast” is explicitly _not_ a member of that set. Patch authored by Abe Skolnik [a.skolnik@samsung.com] and Stephen Canon [scanon@apple.com]. Differential Revision: https://reviews.llvm.org/D24481 llvm-svn: 282259
* Minor tweak. Avoid hardcoding.Daniel Marjamaki2016-09-231-1/+1
| | | | llvm-svn: 282242
* Simplify Clang's version number configuration in CMake.David L. Jones2016-09-151-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the Clang version is computed as follows: 1. LLVM defines major, minor, and patch versions, all statically set. Today, these are 4, 0, and 0, respectively. 2. The static version numbers are combined into PACKAGE_VERSION along with a suffix, so the result today looks like "4.0.0svn". 3. Clang extracts CLANG_VERSION from PACKAGE_VERSION using a regexp. The regexp allows the patch level to omitted, and drops any non-digit trailing values. Today, this result looks like "4.0.0". 4. CLANG_VERSION is then split further into CLANG_VERSION_MAJOR and CLANG_VERSION_MINOR. Today, these resolve to 4 and 0, respectively. 5. If CLANG_VERSION matches a regexp with three version components, then CLANG_VERSION_PATCHLEVEL is extracted and the CLANG_HAS_VERSION_PATCHLEVEL variable is set to 1. Today, these values are 0 and 1, respectively. 6. The CLANG_VERSION_* variables (and CLANG_HAS_VERSION_PATCHLEVEL) are configured into [llvm/tools/clang/]include/clang/Basic/Version.inc verbatim by CMake. 7. In [llvm/tools/clang/]include/clang/Basic/Version.h, macros are defined conditionally, based on CLANG_HAS_VERSION_PATCHLEVEL, to compute CLANG_VERSION_STRING as either a two- or three-level version number. Today, this value is "4.0.0", because despite the patchlevel being 0, it was matched by regexp and is thus "HAS"ed by the preprocessor. This string is then used wherever Clang's "version" is needed [*]. [*] Including, notably, by compiler-rt, for computing its installation path. This change collapses steps 2-5 by defaulting Clang to use LLVM's (non-string) version components for the Clang version (see [*] for why not PACKAGE_VERSION), and collapses steps 6 and 7 by simply writing CLANG_VERSION_STRING into Version.inc. The Clang version today always uses the patchlevel form, so the collapsed Version.inc does not have logic for a version without a patch level. Historically speaking, this technique began with the VER file in r82085 (which survives in the form of the regexp in #3). The major, minor, and patchlevel versions were introduced by r106863 (which remains in #4-6). The VER file itself was deleted in favor of the LLVM version number in r106914. On the LLVM side, the individual LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, and PACKAGE_VERSION weren't introduced for nearly two more years, until r150405. llvm-svn: 281666
* [sanitizer-coverage] add yet another flavour of coverage instrumentation: ↵Kostya Serebryany2016-09-141-0/+2
| | | | | | trace-pc-guard. The intent is to eventually replace all of {bool coverage, 8bit-counters, trace-pc} with just this one. Clang part llvm-svn: 281432
* Remove excessive padding from PTHWriterAlexander Shaposhnikov2016-09-131-3/+3
| | | | | | | | | | | The class PTHWriter is in lib/Frontend/CacheTokens.cpp inside the anonymous namespace. This diff changes the order of fields an removes excessive padding. Test plan: make -j8 check-clang Differential revision: https://reviews.llvm.org/D23902 llvm-svn: 281385
* Reapply r281276 with passing -emit-llvm in one of the testsAdam Nemet2016-09-131-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281293
* Revert "Add -fdiagnostics-show-hotness"Adam Nemet2016-09-131-6/+0
| | | | | | | | This reverts commit r281276. Many bots are failing. llvm-svn: 281279
* Add -fdiagnostics-show-hotnessAdam Nemet2016-09-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281276
OpenPOWER on IntegriCloud