summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* [PS4] Undo dialect tweak for Objective-C.Paul Robinson2016-12-141-2/+4
| | | | | | | | In r267772, we had set the PS4's default dialect for both C and Objective-C to gnu99. Make that change only for C; we don't really support Objective-C/C++ so there's no point fiddling the dialect. llvm-svn: 289625
* Revert "[Modules] Make header inclusion order from umbrella dirs deterministic"Bruno Cardoso Lopes2016-12-121-11/+3
| | | | | | | | | | | Reverts commit r289478. This broke http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2070 (and maybe http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/2246) llvm-svn: 289494
* [Modules] Make header inclusion order from umbrella dirs deterministicBruno Cardoso Lopes2016-12-121-3/+11
| | | | | | | | | | | | | Sort the headers by name before adding the includes in collectModuleHeaderIncludes. This makes the include order for building umbrellas deterministic across different filesystems and also guarantees that the ASTWriter always dump top headers in the same order. There's currently no good way to test for this behavior. rdar://problem/28116411 llvm-svn: 289478
* [CrashReproducer] Collect PCH included via -include-pchBruno Cardoso Lopes2016-12-121-0/+33
| | | | | | | | | | | | Collect the necessary input PCH files. Do not try to validate the AST before copying it out because if the crash is in this path, we won't be able to collect it. Instead only check if it's a file containg an AST. rdar://problem/27913709 llvm-svn: 289460
* [Frontend] Use vfs for directory iteration while searching PCHs. NFCIBruno Cardoso Lopes2016-12-121-3/+4
| | | | | | | Use the vfs lookup instead of real filesytem and handle the case where -include-pch is a directory and this dir is searched for a PCH. llvm-svn: 289459
* [CrashReproducer] Setup a module collector callback for HeaderIncludeBruno Cardoso Lopes2016-12-111-0/+20
| | | | | | | | | Collect missing include that cannot be fetched otherwise (e.g. when using headermaps). rdar://problem/27913709 llvm-svn: 289361
* [CrashReproducer] Collect headermap filesBruno Cardoso Lopes2016-12-111-1/+13
| | | | | | | | | | Include headermaps (.hmap files) in the .cache directory and add VFS entries. All headermaps are known after HeaderSearch setup, collect them right after. rdar://problem/27913709 llvm-svn: 289360
* Simplify parseShowColorsArgs logic, NFC.Yaron Keren2016-12-101-13/+4
| | | | llvm-svn: 289328
* Revert r288626, which reverts r288449. Original commit message:Richard Smith2016-12-061-4/+17
| | | | | | Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually. llvm-svn: 288741
* Revert "Recover better from an incompatible .pcm file being provided by ↵Daniel Jasper2016-12-041-17/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually." This reverts commit r288449. I believe that this is currently faulty wrt. modules being imported inside namespaces. Adding these lines to the new test: namespace n { #include "foo.h" } Makes it break with fatal error: import of module 'M' appears within namespace 'n' However, I believe it should fail with error: redundant #include of module 'M' appears within namespace 'n' I have tracked this down to us now inserting a tok::annot_module_begin instead of a tok::annot_module_include in Preprocessor::HandleIncludeDirective() and then later in Parser::parseMisplacedModuleImport(), we hit the code path for tok::annot_module_begin, which doesn't set FromInclude of checkModuleImportContext to true (thus leading to the "wrong" diagnostic). llvm-svn: 288626
* [Frontend] Fix an issue where a quoted search path is incorrectlyAlex Lorenz2016-12-021-1/+1
| | | | | | | | | | | | | | | removed as a duplicate header search path The commit r126167 started passing the First index into RemoveDuplicates, but forgot to update 0 to First in the loop that looks for the duplicate. This resulted in a bug where an -iquoted search path was incorrectly removed if you passed in the same path into -iquote and more than one time into -isystem. rdar://23991350 Differential Revision: https://reviews.llvm.org/D27298 llvm-svn: 288491
* p0012r1: define corresponding feature test macroRichard Smith2016-12-021-1/+1
| | | | llvm-svn: 288452
* Recover better from an incompatible .pcm file being provided by -fmodule-file=.Richard Smith2016-12-021-4/+17
| | | | | | | | | | | We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually. llvm-svn: 288449
* Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI ↵Richard Smith2016-12-011-1/+0
| | | | | | here. llvm-svn: 288304
* getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.John McCall2016-11-292-14/+13
| | | | llvm-svn: 288203
* [Frontend] Add a predefined macro that describes the Objective-C bool typeAlex Lorenz2016-11-211-0/+3
| | | | | | | | | | | | | This commit adds a new predefined macro named __OBJC_BOOL_IS_BOOL that describes the Objective-C boolean type: its value is zero if the Objective-C boolean uses the signed character type, otherwise its value is one as the Objective-C boolean uses the builtin boolean type. rdar://21170440 Differential Revision: https://reviews.llvm.org/D26234 llvm-svn: 287529
* 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
OpenPOWER on IntegriCloud