aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
AgeCommit message (Collapse)AuthorFilesLines
2017-07-06Reject attempts to build a module without -fmodules, rather than silently ↵Richard Smith1-0/+10
doing weird things. llvm-svn: 307316
2017-07-06 [Objective-C] Fix non-determinism in clangMandeep Singh Grang1-4/+5
Summary: Iteration of the unordered Ivars causes objc-modern-metadata-visibility.mm (uncovered by reverse iterating SmallPtrSet). Reviewers: dblaikie, davide, rsmith Reviewed By: dblaikie Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D34860 llvm-svn: 307296
2017-07-03fix trivial typos in comments; NFCHiroshi Inoue2-2/+2
llvm-svn: 307007
2017-07-01fix trivial typos; NFCHiroshi Inoue1-1/+1
llvm-svn: 306954
2017-07-01Changed Opts.EABIVersion type string to llvm::EABI enum classYuka Takahashi1-1/+1
Summary: Changed EABIVersion type from string to llvm::EABI. It seems it was just a typo and this is intended implementation. Differential Revision: https://reviews.llvm.org/D34595 llvm-svn: 306953
2017-07-01Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak1-6/+12
Summary: Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the documentation to fix an error -- I had used the wrong syntax for a link. llvm-svn: 306948
2017-07-01Revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak1-12/+6
Summary: The commit caused a documentation breakage. llvm-svn: 306946
2017-07-01[Driver] Add -fdiagnostics-hotness-thresholdBrian Gesiak1-6/+12
Summary: Depends on https://reviews.llvm.org/D34867. Add a Clang frontend option to enable optimization remark hotness thresholds, which were added to LLVM in https://reviews.llvm.org/D34867. This prevents diagnostics that do not meet a minimum hotness threshold from being output. When generating optimization remarks for large codebases with a ton of cold code paths, this option can be used to limit the optimization remark output at a reasonable size. Discussion of this change can be read here: http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html Reviewers: anemet, davidxl, hfinkel Reviewed By: anemet Subscribers: fhahn, cfe-commits Differential Revision: https://reviews.llvm.org/D34868 llvm-svn: 306945
2017-06-30Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM'sChandler Carruth1-1/+0
basic block vectorizer. This vectorizer has had no known users for many, many years and is completely surpassed by the normal '-fvectorize-slp'-controlled SLP vectorizer in LLVM. Hal proposed this back in 2014 to no objections: http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html While this patch completely removes the flag, Joerg is working on a patch that will add it back in a way that warns users and ignores the flag in a clear and well factored way (so that we can keep doing this going forward). Differential Revision: https://reviews.llvm.org/D34846 llvm-svn: 306786
2017-06-29Teach ASTReader how to read only the Preprocessor state from an AST file, ↵Richard Smith6-29/+37
not the ASTContext state. We use this when running a preprocessor-only action on an AST file in order to avoid paying the runtime cost of loading the extra information. llvm-svn: 306760
2017-06-29[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.Tim Shen1-0/+4
Differential Revision: https://reviews.llvm.org/D34790 llvm-svn: 306757
2017-06-29[Sema] Issue diagnostics if a new/delete expression generates a call toAkira Hatanaka1-0/+2
a c++17 aligned allocation/deallocation function that is unavailable in the standard library on Apple platforms. The aligned functions are implemented only in the following versions or later versions of the OSes, so clang issues diagnostics if the deployment target being targeted is older than these: macosx: 10.13 ios: 11.0 tvos: 11.0 watchos: 4.0 The diagnostics are issued whenever the aligned functions are selected except when the selected function has a definition in the same file. If there is a user-defined function available somewhere else, option -Wno-aligned-allocation-unavailable can be used to silence the diagnostics. rdar://problem/32664169 Differential Revision: https://reviews.llvm.org/D34574 llvm-svn: 306722
2017-06-29[OpenMP] Add support for auxiliary triple specificationGheorghe-Teodor Bercea3-3/+8
Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa. Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar Reviewed By: Hahnfeld Subscribers: rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D29339 llvm-svn: 306689
2017-06-29Track the set of module maps read while building a .pcm file and reload ↵Richard Smith3-22/+33
those when preprocessing from that .pcm file. llvm-svn: 306628
2017-06-28Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.Ilya Biryukov2-4/+4
Summary: It used to always call into the RealFileSystem before. Reviewers: bkramer, krasimir, klimek, bruno Reviewed By: klimek Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D34469 llvm-svn: 306549
2017-06-27Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""Christof Douma4-227/+167
This reverts commit r305688 meaning it reintroduces r305684. To repeat: [NFC] Refactor DiagnosticRenderer to use FullSourceLoc Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. This breaks clang-tidy and clng-query which will be fixed in a commit soon after. Patch by Sanne Wouda Differential Revision: https://reviews.llvm.org/D31709 llvm-svn: 306384
2017-06-26Remove some redundant setup when preprocessing .pcm files.Richard Smith1-1/+0
Both of these steps are immediately overwritten by the FrontendAction setup. llvm-svn: 306325
2017-06-26When preprocessing with -frewrite-imports and -fmodule-file=, do not pass allRichard Smith1-0/+2
modules to preprocessing of nested .pcm files. Making those module files available results in loading more .pcm files than necessary, and potentially in misbehavior if a module makes itself visible during its own compilation (as parts of that module that have not yet been processed would then become visible). llvm-svn: 306320
2017-06-23Revert "Revert r305164/5/7."Saleem Abdulrasool1-3/+16
Restore the `-gz` option to the driver with some minor tweaks to handle the additional case for `-Wa,--compress-debug-sections`. This intends to make the compression of the debug information controllable from the driver. The following is the behaviour: -gz enable compression (ambiguous for format, will default to zlib-gnu) -gz=none disable compression -gz=zlib-gnu enable compression (deprecated GNU style zlib compression) -gz=zlib enable compression (zlib based compression) Although -Wa,-compress-debug-sections works, it should be discouraged when using the driver to invoke the assembler. However, we permit the assembler to accept the GNU as style argument --compress-debug-sections to maintain compatibility. Note, -gz/-gz= does *NOT* imply -g. That is, you need to additionally specific -g for debug information to be generated. llvm-svn: 306115
2017-06-23[Frontend] 'Show hotness' can be used with a sampling profileBrian Gesiak1-2/+6
Summary: Prior to this change, using `-fdiagnostics-show-hotness` with a sampling profile specified via `-fprofile-sample-use=` would result in the Clang frontend emitting a warning: "argument '-fdiagnostics-show-hotness' requires profile-guided optimization information". Of course, a sampling profile *is* profile-guided optimization information, so the warning is misleading. Furthermore, despite the warning, hotness was displayed based on the data in the sampling profile. Prevent the warning from being emitted when a sampling profile is used, and add a test that verifies this. Reviewers: anemet, davidxl Reviewed By: davidxl Subscribers: danielcdh, cfe-commits Differential Revision: https://reviews.llvm.org/D34082 llvm-svn: 306079
2017-06-21Fixed compiler warnings after r305890.Ilya Biryukov1-10/+4
Should fix buildbots that pass -Werror. llvm-svn: 305902
2017-06-21Fix unused-variable compilation error.Haojian Wu1-0/+2
llvm-svn: 305898
2017-06-21Moved code hanlding precompiled preamble out of the ASTUnit.Ilya Biryukov3-589/+779
Reviewers: bkramer, krasimir, arphaman, akyrtzi, klimek Reviewed By: klimek Subscribers: mgorny, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D34287 llvm-svn: 305890
2017-06-20Turn off "disable free" mode when preprocessing imported module files inRichard Smith1-0/+1
-frewrite-imports mode. This could end up accumulating a very large amount of intermediate state. Clear it out after each module file is processed. llvm-svn: 305764
2017-06-19Support non-identifier module names when preprocessing modules.Richard Smith4-11/+27
llvm-svn: 305758
2017-06-19Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"Christof Douma4-167/+227
This reverts commit 305684. This patch breaks extra/tools/clang-tidy llvm-svn: 305688
2017-06-19[NFC] Refactor DiagnosticRenderer to use FullSourceLocChristof Douma4-227/+167
Move the DiagnosticRenderer and its dependents to using FullSourceLocs instead of a SourceLocation and SourceManager pointer. The changeset is rather large but entirely mechanical. This is step one to allow DiagnosticRenderer to take either llvm::SMLocs or clang::SourceLocations. Patch by Sanne Wouda Review: https://reviews.llvm.org/D31709 Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd llvm-svn: 305684
2017-06-16Killing a tab and some other spurious whitespace; NFC.Aaron Ballman1-1/+1
llvm-svn: 305586
2017-06-16[PR33394] Avoid lexing editor placeholders when Clang is used onlyAlex Lorenz1-40/+54
for preprocessing r300667 added support for editor placeholder to Clang. That commit didn’t take into account that users who use Clang for preprocessing only (-E) will get the "editor placeholder in source file" error when preprocessing their source (PR33394). This commit ensures that Clang doesn't lex editor placeholders when running a preprocessor only action. rdar://32718000 Differential Revision: https://reviews.llvm.org/D34256 llvm-svn: 305576
2017-06-15Handle -ast-dump-all when passed as the only option.Aaron Ballman1-1/+1
Patch by Don Hinton llvm-svn: 305432
2017-06-14Be more strict when checking the -flto option valueYuka Takahashi1-2/+8
Summary: It seems -flto must be either "thin" or "full". I think the use of containValue is just a typo. Reviewers: ruiu, tejohnson Subscribers: mehdi_amini, inglorion Differential Revision: https://reviews.llvm.org/D34055 llvm-svn: 305392
2017-06-12Revert r305164/5/7.Daniel Jasper1-16/+3
cc1as does not currently access the "--" version of this flag. At the very least this needs to be fixed and proper test cases need to be added. Simple reproducer: clang -Wa,--compress-debug-sections /tmp/test.cc Result: error: unknown argument: '--compress-debug-sections' llvm-svn: 305182
2017-06-11Driver: add support for `-gz` and `-gz=`Saleem Abdulrasool1-3/+16
These options control the behaviour of the compression of debug info sections on ELF targets. Our behaviour slightly diverges from the behaviour of GCC. `-gz` maps to the `-compress-debug-sections` rather than `-compress-debug-sections=zlib` or `-compress-debug-sections=zlib-gnu`. This small divergence allows us to be compatible across versions of binutils (=zlib support was introduced in 2.26, while earlier versions only support =zlib-gnu). This also allows users to not have to worry about the version of the assembler they may be using if they are not using the IAS. Previously, users would have had to go through the internal option `-compress-debug-sectionss` and pass that through to the assembler, which is no longer needed. llvm-svn: 305165
2017-06-09Attempt to fix shared library build: RewriteFrontend depends on ↵Richard Smith1-0/+1
Serialization after r305116. llvm-svn: 305121
2017-06-09Add -frewrite-imports flag.Richard Smith3-18/+111
If specified, when preprocessing, the contents of imported .pcm files will be included in preprocessed output. The resulting preprocessed file can then be compiled standalone without the module sources or .pcm files. llvm-svn: 305116
2017-06-09Add #pragma clang module build/endbuild pragmas for performing a module buildRichard Smith2-70/+166
as part of a compilation. This is intended for two purposes: 1) Writing self-contained test cases for modules: we can now write a single source file test that builds some number of module files on the side and imports them. 2) Debugging / test case reduction. A single-source testcase is much more amenable to reduction, compared to a VFS tarball or .pcm files. llvm-svn: 305101
2017-06-09Speed up preamble loadingErik Verbruggen1-7/+12
Cache filename - SourceLocation pairs to speed up preamble loading and global completion. This is especially relevant for windows, where preamble loading takes a while. Patch by Ivan Donchevskii! Differential Revision: http://reviews.llvm.org/D33493 llvm-svn: 305061
2017-06-09Remove 'Filename' parameter from BeginSourceFileAction.Richard Smith4-21/+12
No-one was using this, and it's not meaningful in general -- FrontendActions can be run on inputs that don't have a corresponding source file. The current frontend input can be obtained by asking the FrontendAction if any future action actually needs it. llvm-svn: 305045
2017-06-09[libclang] Introduce a new parsing option ↵Argyrios Kyrtzidis1-1/+2
'CXTranslationUnit_SingleFileParse' that puts preprocessor in a mode for parsing a single file only. This is useful for parsing a single file, as a fast/inaccurate 'mode' that can still provide declarations from the file, like the classes and their methods. llvm-svn: 305044
2017-06-09Represent debug information compression type fullySaleem Abdulrasool1-1/+3
This is tied with the LLVM side of the change to expose the debug information compression types to clang. We now track the compression type as an enumeration rather than a boolean. We still use the same value (GNU) that we did previously. This is in preparation to support passing down the compression type and switch it based on the command line. llvm-svn: 305039
2017-06-08[sanitizer-coverage] one more flavor of coverage: ↵Kostya Serebryany1-0/+2
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. Reapplying revisions 304630, 304631, 304632, 304673, see PR33308 llvm-svn: 305026
2017-06-06Retain header search and preprocessing options from AST file when emittingRichard Smith2-9/+30
preprocessed text for an AST file. llvm-svn: 304756
2017-06-05Factor out and unify emission of "module is unavailable" diagnostics.Richard Smith2-28/+6
Inspired by post-commit review of r304190. llvm-svn: 304728
2017-06-05Rather than rejecting attempts to run preprocessor-only actions on AST files,Richard Smith2-20/+94
replay the steps taken to create the AST file with the preprocessor-only action installed to produce preprocessed output. This can be used to produce the preprocessed text for an existing .pch or .pcm file. llvm-svn: 304726
2017-06-05Revert "[sanitizer-coverage] one more flavor of coverage: ↵Renato Golin1-2/+0
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)" This reverts commit r304631, as it broke ARM/AArch64 bots for 2 days. llvm-svn: 304697
2017-06-03Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova3-0/+4
llvm-svn: 304645
2017-06-03[sanitizer-coverage] one more flavor of coverage: ↵Kostya Serebryany1-0/+2
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part) llvm-svn: 304631
2017-06-02Support lazy stat'ing of files referenced by module maps.Richard Smith1-6/+20
This patch adds support for a `header` declaration in a module map to specify certain `stat` information (currently, size and mtime) about that header file. This has two purposes: - It removes the need to eagerly `stat` every file referenced by a module map. Instead, we track a list of unresolved header files with each size / mtime (actually, for simplicity, we track submodules with such headers), and when attempting to look up a header file based on a `FileEntry`, we check if there are any unresolved header directives with that `FileEntry`'s size / mtime and perform deferred `stat`s if so. - It permits a preprocessed module to be compiled without the original files being present on disk. The only reason we used to need those files was to get the `stat` information in order to do header -> module lookups when using the module. If we're provided with the `stat` information in the preprocessed module, we can avoid requiring the files to exist. Unlike most `header` directives, if a `header` directive with `stat` information has no corresponding on-disk file the enclosing module is *not* marked unavailable (so that behavior is consistent regardless of whether we've resolved a header directive, and so that preprocessed modules don't get marked unavailable). We could actually do this for all `header` directives: the only reason we mark the module unavailable if headers are missing is to give a diagnostic slightly earlier (rather than waiting until we actually try to build the module / load and validate its .pcm file). Differential Revision: https://reviews.llvm.org/D33703 llvm-svn: 304515
2017-06-02PR32848: There isn't necessarily a FileChanged or FileSkipped for every ↵Richard Smith1-4/+3
InclusionDirective callback. In particular, you don't get one if the inclusion directive encountered an error. Don't assert in that case. llvm-svn: 304506
2017-06-01Escape filenames in module map line marker directives, to unbreak Windows ↵Richard Smith2-4/+10
build bots. llvm-svn: 304464