summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r312105 [modules] Add ability to specify module name to module file ↵Victor Leschuk2017-08-303-33/+10
| | | | | | | | mapping Looks like it breaks win10 builder. llvm-svn: 312112
* [modules] Add ability to specify module name to module file mappingBoris Kolpackov2017-08-303-10/+33
| | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 llvm-svn: 312105
* Minimal runtime for UBSan.Evgeniy Stepanov2017-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An implementation of ubsan runtime library suitable for use in production. Minimal attack surface. * No stack traces. * Definitely no C++ demangling. * No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general. * as simple as possible Minimal CPU and RAM overhead. * Source locations unnecessary in the presence of (split) debug info. * Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at. * above two items save 3% binary size. When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt. Reviewers: pcc, kcc Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D36810 llvm-svn: 312029
* [modules-ts] Omit submodule semantics for TS modulesBoris Kolpackov2017-08-291-2/+17
| | | | | | | | | | | | If a TS module name has more than one component (e.g., foo.bar) then we erroneously activated the submodule semantics when encountering a module declaration in the module implementation unit (e.g., 'module foo.bar;'). Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35678 llvm-svn: 312007
* Add flag to request Clang is ABI-compatible with older versions of itselfRichard Smith2017-08-261-0/+27
| | | | | | | | | | | | | | | | | | This patch adds a flag -fclang-abi-compat that can be used to request that Clang attempts to be ABI-compatible with some older version of itself. This is provided on a best-effort basis; right now, this can be used to undo the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return by value of class types affected by that change, and to undo the ABI change in r262688, reverting Clang to using integer registers rather than SSE registers for passing <1 x long long> vectors. The intent is that we will maintain this backwards compatibility path as we make ABI-breaking fixes in future. The reversion to the old behavior for r310401 is also applied to the PS4 target since that change is not part of its platform ABI (which is essentially to do whatever Clang 3.2 did). llvm-svn: 311823
* [Frontend] Fix printing policy for AST context loaded from fileVedant Kumar2017-08-251-0/+3
| | | | | | | | | | | | | In ASTUnit::LoadFromASTFile, the context object is set up using default-constructed LangOptions (which only later get populated). As the language options are used in the constructor of PrintingPolicy, this needs to be updated explicitly after the language options are available. Patch by Johann Klähn! Differential Revision: https://reviews.llvm.org/D35271 llvm-svn: 311787
* Expose -mllvm -accurate-sample-profile to clang.Dehao Chen2017-08-241-0/+2
| | | | | | | | | | | | | | Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20% Reviewers: davidxl, rsmith Reviewed By: davidxl, rsmith Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D37091 llvm-svn: 311707
* Revert r311442 (Fix templated type alias completion when using global ↵Erik Verbruggen2017-08-221-2/+1
| | | | | | | | | | completion cache) Failing Tests (2): Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp Clang :: SemaCXX/alias-template.cpp llvm-svn: 311445
* Fix templated type alias completion when using global completion cacheErik Verbruggen2017-08-221-1/+2
| | | | | | | | | | | | | | | | | | | | | When we have enabled cache for global completions we did not have diagnostics for Bar and could not complete Ba as in provided code example. template <typename T> struct Foo { T member; }; template<typename T> using Bar = Foo<T>; int main() { Ba } Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D35355 llvm-svn: 311442
* [SanitizerCoverage] Add stack depth tracing instrumentation.Matt Morehouse2017-08-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: Augment SanitizerCoverage to insert maximum stack depth tracing for use by libFuzzer. The new instrumentation is enabled by the flag -fsanitize-coverage=stack-depth and is compatible with the existing trace-pc-guard coverage. The user must also declare the following global variable in their code: thread_local uintptr_t __sancov_lowest_stack https://bugs.llvm.org/show_bug.cgi?id=33857 Reviewers: vitalybuka, kcc Reviewed By: vitalybuka Subscribers: kubamracek, hiraditya, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D36839 llvm-svn: 311186
* Fix comments about __OPENCL_MEMORY_SCOPE_* macrosYaxun Liu2017-08-161-1/+1
| | | | llvm-svn: 310986
* [OpenCL] Support variable memory scope in atomic builtinsYaxun Liu2017-08-151-4/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D36580 llvm-svn: 310924
* Implement latest feature test macro recommendations, P0096R4.Richard Smith2017-08-111-2/+3
| | | | llvm-svn: 310694
* Fixed a race condition in PrecompiledPreamble.Ilya Biryukov2017-08-101-1/+9
| | | | | | | | | | | | | | | | Summary: Two PrecompiledPreambles, used in parallel on separate threads, could be writing preamble to the same temporary file. Reviewers: bkramer, krasimir, klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36529 llvm-svn: 310618
* Use "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.Nico Weber2017-08-081-2/+8
| | | | | | | | | | | | | | | This helps some tools that do things based on the output's extension. For example, we got reports from users on Windows that have a tool that scan a build output dir (but skip .obj files). The tool would keep the "foo.obj-12345" file open, and then when clang tried to rename the temp file to the final output filename, that would fail. By making the tempfile end in ".obj.tmp", tools like this could now have a rule to ignore .tmp files. This is a less ambitious reland of https://reviews.llvm.org/D36238 https://reviews.llvm.org/D36413 llvm-svn: 310376
* [OpenMP] Error when trying to offload to an unsupported architectureGheorghe-Teodor Bercea2017-08-071-1/+8
| | | | | | | | | | | | | | Summary: Throw an error when offloading is unsupported for a particular target architecture. Reviewers: sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld Reviewed By: ABataev Subscribers: cfe-commits, rengolin Differential Revision: https://reviews.llvm.org/D32035 llvm-svn: 310307
* [OpenMP] Prevent emission of exception handling code when using OpenMP to ↵Gheorghe-Teodor Bercea2017-08-071-0/+7
| | | | | | | | | | | | | | | | offload to NVIDIA devices. Summary: For the OpenMP toolchain which offloads to NVIDIA GPUs make sure that no exception handling code is emitted. Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, hfinkel, tstellar Reviewed By: ABataev, Hahnfeld Subscribers: rengolin, Hahnfeld, cfe-commits Differential Revision: https://reviews.llvm.org/D29904 llvm-svn: 310306
* Add OpenCL 2.0 atomic builtin functions as Clang builtinYaxun Liu2017-08-041-0/+13
| | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions. Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions. This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin functions, which supports generating LLVM atomic instructions with synchronization scope operand. Currently only constant memory scope argument is supported. Support of non-constant memory scope argument will be added later. Differential Revision: https://reviews.llvm.org/D28691 llvm-svn: 310082
* Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary ↵NAKAMURA Takumi2017-08-041-6/+2
| | | | | | | | file name." It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm" llvm-svn: 310030
* Use "foo-12345.o" instead of "foo.o-12345" as temporary file name.Nico Weber2017-08-031-2/+6
| | | | | | | | | | | | | | This helps some tools that do things based on the output's extension. For example, we got reports from users on Windows that have a tool that scan a build output dir (but skip .obj files). The tool would keep the "foo.obj-12345" file open, and then when clang tried to rename the temp file to the final output filename, that would fail. By making the tempfile end in ".obj", tools like this will now skip the temp files as well. https://reviews.llvm.org/D36238 llvm-svn: 309984
* [mips] Revert r309942 & r309940Simon Dardis2017-08-031-2/+0
| | | | | | | | This reverts commit r309942 & commit r309940. A revert was requested following post commit review. llvm-svn: 309978
* [mips] Implement -muninit-const-in-rodataSimon Dardis2017-08-031-0/+2
| | | | | | | | | | | This option when combined with -mgpopt and -membedded-data places all uninitialized constant variables in the read-only section. Reviewers: atanasyan, nitesh.jain Differential Revision: https://reviews.llvm.org/D35917 llvm-svn: 309940
* [sanitizer-coverage] clang flags pumbing for -fsanitize-coverage=pc-tableKostya Serebryany2017-07-281-0/+1
| | | | llvm-svn: 309338
* [Frontend] Mark some ASTUnit methods as const. NFC.Vedant Kumar2017-07-251-7/+7
| | | | | | | | Patch by Hamza Sood! Differential Revision: https://reviews.llvm.org/D35729 llvm-svn: 309013
* Remove Bitrig: Clang ChangesErich Keane2017-07-211-1/+0
| | | | | | | | Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned. Differential Revision: https://reviews.llvm.org/D35708 llvm-svn: 308797
* [CMake] Move CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) into ↵NAKAMURA Takumi2017-07-183-0/+3
| | | | | | | | | | | | | | clang/Config/config.h. LLVM_ENABLE_MODULES is sensitive of -D. Move them into config.h. FIXME: It'd be better that they are #cmakedefine01 rather than #cmakedefine. (#if FOO rather than #if defined(FOO)) Then we can find missing #include "clang/Config/config.h" in the future. Differential Revision: https://reviews.llvm.org/D35527 llvm-svn: 308277
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. I will also directly update some extra clang tooling that is broken by the change from Argument to Parameter. Hopefully the bots will stay appeased. Thanks! llvm-svn: 308190
* Revert changes from my previous refactoring - will need to fix dependencies ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | in clang's extra tooling (such as clang-tidy etc.). Sorry about that. llvm-svn: 308158
* [NFC] Refactor the Preprocessor function that handles Macro definitions and ↵Faisal Vali2017-07-171-2/+2
| | | | | | | | | | | | | | rename Arguments to Parameters in Macro Definitions. - Extracted the reading of the tokens out into a separate function. - Replace 'Argument' with 'Parameter' when referring to the identifiers of the macro definition (as opposed to the supplied arguments - MacroArgs - during the macro invocation). This is in preparation for submitting patches for review to implement __VA_OPT__ which will otherwise just keep lengthening the HandleDefineDirective function and making it less comprehensible. Thanks! llvm-svn: 308157
* [c++2a] Add option -std=c++2a to enable support for potential/transitional ↵Faisal Vali2017-07-162-1/+5
| | | | | | | | | | C++2a features - as usual C++2a implies all the C++'s that came before it. Thank you Aaron for the feedback here: https://reviews.llvm.org/D35454 llvm-svn: 308118
* [clang] buildFixItInsertionLine should use Hints of the same FID and LineNoChih-Hung Hsieh2017-07-121-6/+5
| | | | | | | | Fix bug https://bugs.llvm.org/show_bug.cgi?id=33734 Differential Revision: https://reviews.llvm.org/D35230 llvm-svn: 307809
* [Frontend] Verify that the bitstream is not empty before readingAlex Lorenz2017-07-071-0/+3
| | | | | | | | | | | | | | the serialised diagnostics Clang should avoid calling report_fatal_error when the file with the serialised diagnostics is empty. This commit changes Clang's serialised diagnostic reader, now it reports an appropriate error instead of crashing. rdar://31939877 Differential Revision: https://reviews.llvm.org/D35069 llvm-svn: 307384
* Reject attempts to build a module without -fmodules, rather than silently ↵Richard Smith2017-07-061-0/+10
| | | | | | doing weird things. llvm-svn: 307316
* [Objective-C] Fix non-determinism in clangMandeep Singh Grang2017-07-061-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
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-032-2/+2
| | | | llvm-svn: 307007
* fix trivial typos; NFCHiroshi Inoue2017-07-011-1/+1
| | | | llvm-svn: 306954
* Changed Opts.EABIVersion type string to llvm::EABI enum classYuka Takahashi2017-07-011-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
* Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-011-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
* Revert "[Driver] Add -fdiagnostics-hotness-threshold"Brian Gesiak2017-07-011-12/+6
| | | | | | | Summary: The commit caused a documentation breakage. llvm-svn: 306946
* [Driver] Add -fdiagnostics-hotness-thresholdBrian Gesiak2017-07-011-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
* Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM'sChandler Carruth2017-06-301-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
* Teach ASTReader how to read only the Preprocessor state from an AST file, ↵Richard Smith2017-06-296-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
* [NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.Tim Shen2017-06-291-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D34790 llvm-svn: 306757
* [Sema] Issue diagnostics if a new/delete expression generates a call toAkira Hatanaka2017-06-291-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
* [OpenMP] Add support for auxiliary triple specificationGheorghe-Teodor Bercea2017-06-293-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
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-293-22/+33
| | | | | | those when preprocessing from that .pcm file. llvm-svn: 306628
* Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.Ilya Biryukov2017-06-282-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
* Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""Christof Douma2017-06-274-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
* Remove some redundant setup when preprocessing .pcm files.Richard Smith2017-06-261-1/+0
| | | | | | Both of these steps are immediately overwritten by the FrontendAction setup. llvm-svn: 306325
* When preprocessing with -frewrite-imports and -fmodule-file=, do not pass allRichard Smith2017-06-261-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
OpenPOWER on IntegriCloud