aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
AgeCommit message (Collapse)AuthorFilesLines
2016-12-11[CrashReproducer] Setup a module collector callback for HeaderIncludeBruno Cardoso Lopes1-0/+20
Collect missing include that cannot be fetched otherwise (e.g. when using headermaps). rdar://problem/27913709 llvm-svn: 289361
2016-12-11[CrashReproducer] Collect headermap filesBruno Cardoso Lopes1-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
2016-12-10Simplify parseShowColorsArgs logic, NFC.Yaron Keren1-13/+4
llvm-svn: 289328
2016-12-06Revert r288626, which reverts r288449. Original commit message:Richard Smith1-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
2016-12-04Revert "Recover better from an incompatible .pcm file being provided by ↵Daniel Jasper1-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
2016-12-02[Frontend] Fix an issue where a quoted search path is incorrectlyAlex Lorenz1-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
2016-12-02p0012r1: define corresponding feature test macroRichard Smith1-1/+1
llvm-svn: 288452
2016-12-02Recover better from an incompatible .pcm file being provided by -fmodule-file=.Richard Smith1-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
2016-12-01Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI ↵Richard Smith1-1/+0
here. llvm-svn: 288304
2016-11-29getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.John McCall2-14/+13
llvm-svn: 288203
2016-11-21[Frontend] Add a predefined macro that describes the Objective-C bool typeAlex Lorenz1-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
2016-11-18Adapt to llvm NamedRegionTimer changesMatthias Braun1-5/+10
We have to specify a name and description for the timers and groups now. llvm-svn: 287371
2016-11-18[CUDA] Initialize our header search using the host triple.Justin Lebar1-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
2016-11-17[Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2-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
2016-11-16Rangify for loops, NFC.Yaron Keren1-11/+8
llvm-svn: 287138
2016-11-16[Frontend] Allow attaching an external sema source to compiler instance and ↵Benjamin Kramer1-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
2016-11-11Add a new optimization option -Og Sylvestre Ledru1-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
2016-11-09[VFS] Replace TimeValue usage with std::chronoPavel Labath1-3/+4
Summary: NFCI Reviewers: benlangmuir, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25948 llvm-svn: 286356
2016-11-08Bitcode: Decouple block info block state from reader.Peter Collingbourne2-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
2016-11-03Instead of resetting the pointer, or releasing it which was the previousChandler Carruth1-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
2016-11-03Using release to free memory is at best confusing -- one would expectChandler Carruth1-1/+1
that its result is in fact used. Instead, use reset. This was pointed out by PVS-Studio. llvm-svn: 285946
2016-11-02Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons3-25/+19
Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
2016-11-02Bitcode: Change reader interface to take memory buffers.Peter Collingbourne2-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
2016-11-01[OpenCL] Override supported OpenCL extensions with -cl-ext optionAlexey Bader1-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
2016-11-01Implement ABI proposal for throwing noexcept function pointers, per discussionRichard Smith1-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
2016-11-01Bitcode: Simplify BitstreamWriter::EnterBlockInfoBlock() interface.Peter Collingbourne1-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
2016-10-31Add comment explaining this mysterious macro name.Richard Smith1-0/+3
llvm-svn: 285631
2016-10-28Revert "[Preprocessor] Support for '-dI' flag"Bruno Cardoso Lopes2-27/+8
This reverts r285411. Tests failing on http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141 llvm-svn: 285416
2016-10-28[Preprocessor] Support for '-dI' flagBruno Cardoso Lopes2-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
2016-10-27Do not print include_next/pragma once warnings when input is a header.Erik Verbruggen1-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
2016-10-21Switch SmallSetVector to use DenseSet when it overflows its inline space.Justin Lebar2-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
2016-10-19Use noexcept instead of LLVM_NOEXCEPT now that all compilers support itReid Kleckner1-1/+1
llvm-svn: 284667
2016-10-19New clang option -mpie-copy-relocations to use copy relocations for PIE builds.Sriraman Tallam1-0/+2
Differential Revision: https://reviews.llvm.org/D19996 llvm-svn: 284638
2016-10-11Reapply [Driver][Diagnostics] Make 'show option names' default for driver ↵Bruno Cardoso Lopes1-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
2016-10-11Fix the build with MSVC 2013 after r283856Reid Kleckner1-4/+8
llvm-svn: 283906
2016-10-11Revert "[Driver][Diagnostics] Make 'show option names' default for driver ↵Renato Golin1-7/+4
warnings" This reverts commit r283827, as it's breaking all ARM/AARch64 bots. llvm-svn: 283868
2016-10-11Turn FileManager DirectoryEntry::Name from raw pointer to StringRef (NFC)Mehdi Amini1-6/+9
llvm-svn: 283856
2016-10-11Add an option to save the backend-produced YAML optimization record to a fileHal Finkel1-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
2016-10-11[Driver][Diagnostics] Make 'show option names' default for driver warningsBruno Cardoso Lopes1-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
2016-10-10Add -fno-sanitize-address-use-after-scope flagVitaly Buka1-2/+5
Reviewers: eugenis Differential Revision: https://reviews.llvm.org/D25453 llvm-svn: 283801
2016-10-10Mark aligned allocation as done.Richard Smith1-1/+2
llvm-svn: 283724
2016-10-08[CUDA] Rename cuda_builtin_vars.h to __clang_cuda_builtin_vars.h.Justin Lebar1-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
2016-10-02[coroutines] Rename driver flag -fcoroutines to -fcoroutines-tsGor Nishanov2-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
2016-10-01Use StringRef for MemoryBuffer identifier API (NFC)Mehdi Amini3-5/+5
llvm-svn: 283043
2016-09-30P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, weRichard Smith2-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
2016-09-30Move UTF functions into namespace llvm.Justin Lebar1-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
2016-09-29Mark P0127R3 as done, and replace its __has_feature check with the ↵Richard Smith1-1/+1
corresponding SD-6 macro. llvm-svn: 282652
2016-09-28Add a couple more tentative names for upcoming SD-6 feature checks. These mightRichard Smith1-0/+4
not reflect the final chosen names, but supporting them now seems to have little downside. llvm-svn: 282629
2016-09-28P0095R3: Implement the latest published revision of SD-6 (C++ feature test ↵Richard Smith1-2/+6
macros). llvm-svn: 282627
2016-09-28P0096R2: Implement more recent revision of SD-6 (C++ feature test macros).Richard Smith1-2/+15
llvm-svn: 282622