summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* Use llvm-config.h instead of config.hIlya Biryukov2017-11-171-1/+1
| | | | | | To fix standalone builds broken by r318411 (config.h is private to llvm). llvm-svn: 318514
* Allow to store precompiled preambles in memory.Ilya Biryukov2017-11-163-80/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: These preambles are built by ASTUnit and clangd. Previously, preambles were always stored on disk. In-memory preambles are routed back to the compiler as virtual files in a custom VFS. Interface of ASTUnit does not allow to use in-memory preambles, as ASTUnit::CodeComplete receives FileManager as a parameter, so we can't change VFS used by the compiler inside the CodeComplete method. A follow-up commit will update clangd in clang-tools-extra to use in-memory preambles. Reviewers: klimek, sammccall, bkramer Reviewed By: klimek Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D39842 llvm-svn: 318411
* Switch -mcount and -finstrument-functions to emit EnterExitInstrumenter ↵Hans Wennborg2017-11-141-0/+2
| | | | | | | | | | | | | | | | attributes This updates -mcount to use the new attribute names (LLVM r318195), and switches over -finstrument-functions to also use these attributes rather than inserting instrumentation in the frontend. It also adds a new flag, -finstrument-functions-after-inlining, which makes the cygprofile instrumentation get inserted after inlining rather than before. Differential Revision: https://reviews.llvm.org/D39331 llvm-svn: 318199
* [completion] complete ObjC interface names in an expressionAlex Lorenz2017-11-141-1/+5
| | | | | | | | Objective-C interfaces can be used in a class property expression. rdar://26982192 llvm-svn: 318129
* New clang option -fno-plt which avoids the PLT and lazy binding while making ↵Sriraman Tallam2017-11-071-0/+1
| | | | | | | | external calls. Differential Revision: https://reviews.llvm.org/D39079 llvm-svn: 317605
* Add default calling convention support for regcall.Erich Keane2017-11-021-3/+4
| | | | | | | | | | | Added support for regcall as default calling convention. Also added code to exclude main when applying default calling conventions. Patch-By: eandrews Differential Revision: https://reviews.llvm.org/D39210 llvm-svn: 317268
* [CFI] Add CFI-icall pointer type generalizationVlad Tsyrklevich2017-10-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change allows generalizing pointers in type signatures used for cfi-icall by enabling the -fsanitize-cfi-icall-generalize-pointers flag. This works by 1) emitting an additional generalized type signature metadata node for functions and 2) llvm.type.test()ing for the generalized type for translation units with the flag specified. This flag is incompatible with -fsanitize-cfi-cross-dso because it would require emitting twice as many type hashes which would increase artifact size. Reviewers: pcc, eugenis Reviewed By: pcc Subscribers: kcc Differential Revision: https://reviews.llvm.org/D39358 llvm-svn: 317044
* Create fewer copies of StringMaps. No functionality change intended.Benjamin Kramer2017-10-221-1/+1
| | | | llvm-svn: 316301
* Revert r316193.Richard Smith2017-10-202-12/+0
| | | | | | | This patch breaks users using -fno-canonical-prefixes, for whom resolving symlinks is not acceptable. llvm-svn: 316195
* Try to shorten system header paths when using -MD depfilesPeter Wu2017-10-192-0/+12
| | | | | | | | | | | | | | | | | | | | | GCC tries to shorten system headers in depfiles using its real path (resolving components like ".." and following symlinks). Mimic this feature to ensure that the Ninja build tool detects the correct dependencies when a symlink changes directory levels, see https://github.com/ninja-build/ninja/issues/1330 An option to disable this feature is added in case "these changed header paths may conflict with some compilation environments", see https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00287.html Note that the original feature request for GCC (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52974) also included paths preprocessed output (-E) and diagnostics. That is not implemented now since I am not sure if it breaks something else. Differential Revision: https://reviews.llvm.org/D37954 llvm-svn: 316193
* [CMake] Use #cmakedefine01 for ↵NAKAMURA Takumi2017-10-183-3/+3
| | | | | | | | | | | | CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) 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/D35541 llvm-svn: 316061
* [modules] When finding the owning module of an instantiated context in templateRichard Smith2017-10-181-3/+10
| | | | | | | instantiation, follow lexical parents not semantic ones: we want to find the module where the pattern was written. llvm-svn: 316055
* Don't print end-of-directive tokens in -E outputReid Kleckner2017-10-161-0/+6
| | | | | | | | | | This comes up when pre-processing standalone .s files containing hash-prefixed comments. The pre-processor should skip the unknown directive and not emit an extra newline as we were doing. Fixes PR34950 llvm-svn: 315953
* [Bitfield] Add an option to access bitfield in a fine-grained manner.Wei Mi2017-10-161-0/+10
| | | | | | | | Currently all the consecutive bitfields are wrapped as a large integer unless there is unamed zero sized bitfield in between. The patch provides an alternative manner which makes the bitfield to be accessed as separate memory location if it has legal integer width and is naturally aligned. Such separate bitfield may split the original consecutive bitfields into subgroups of consecutive bitfields, and each subgroup will be wrapped as an integer. Now This is all controlled by an option -ffine-grained-bitfield-accesses. The alternative of bitfield access manner can improve the access efficiency of those bitfields with legal width and being aligned, but may reduce the chance of load/store combining of other bitfields, so it depends on how the bitfields are defined and actually accessed to choose when to use the option. For now the option is off by default. Differential revision: https://reviews.llvm.org/D36562 llvm-svn: 315915
* Add -f[no-]double-square-bracket-attributes as new driver options to control ↵Aaron Ballman2017-10-151-0/+6
| | | | | | use of [[]] attributes in all language modes. This is the initial implementation of WG14 N2165, which is a proposal to add [[]] attributes to C2x, but also allows you to enable these attributes in C++98, or disable them in C++11 or later. llvm-svn: 315856
* Support for destroying operator delete, per C++2a proposal P0722.Richard Smith2017-10-131-3/+4
| | | | | | | | | | This feature is not (yet) approved by the C++ committee, so this is liable to be reverted or significantly modified based on committee feedback. No functionality change intended for existing code (a new type must be defined in namespace std to take advantage of this feature). llvm-svn: 315662
* Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.Ilya Biryukov2017-10-092-1/+2
| | | | | | | | | | | | | | | | Summary: It was previsouly set only in ASTUnit, but it should be set for all client of PrecompiledPreamble. Reviewers: erikjv, bkramer, klimek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38617 llvm-svn: 315212
* Driver: hoist the `wchar_t` handling to the driverSaleem Abdulrasool2017-10-062-1/+11
| | | | | | | | | | | | | | | | Move the logic for determining the `wchar_t` type information into the driver. Rather than passing the single bit of information of `-fshort-wchar` indicate to the frontend the desired type of `wchar_t` through a new `-cc1` option of `-fwchar-type` and indicate the signedness through `-f{,no-}signed-wchar`. This replicates the current logic which was spread throughout Basic into the `RenderCharacterOptions`. Most of the changes to the tests are to ensure that the frontend uses the correct type. Add a new test set under `test/Driver/wchar_t.c` to ensure that we calculate the proper types for the various cases. llvm-svn: 315126
* Revert "Add /System/Library/PrivateFrameworks as a header search path."Douglas Gregor2017-10-021-1/+0
| | | | | | This reverts commit f7a95215a435aa8d5f64f43a8bb23ba077270755. llvm-svn: 314697
* [PS4] Tidy up some debug-tuning v. triple decision-making.Paul Robinson2017-09-291-1/+1
| | | | llvm-svn: 314558
* [DWARF] Allow forward declarations of a class template instantiationPaul Robinson2017-09-281-0/+1
| | | | | | | | | to have child entries describing the template parameters. This will be on by default for SCE tuning. Differential Revision: https://reviews.llvm.org/D14358 llvm-svn: 314444
* [Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed outputEli Friedman2017-09-271-0/+18
| | | | | | | | Patch by Zbigniew Sarbinowski! Differential Revision: https://reviews.llvm.org/D37861 llvm-svn: 314364
* [PCH] Fixed preamble breaking with BOM presence (and particularly, ↵Cameron Desrochers2017-09-202-3/+2
| | | | | | | | | | | | | | fluctuating BOM presence) This patch fixes broken preamble-skipping when the preamble region includes a byte order mark (BOM). Previously, parsing would fail if preamble PCH generation was enabled and a BOM was present. This also fixes preamble invalidation when a BOM appears or disappears. This may seem to be an obscure edge case, but it happens regularly with IDEs that pass buffer overrides that never (or always) have a BOM, yet the underlying file from the initial parse that generated a PCH might (or might not) have a BOM. I've included a test case for these scenarios. Differential Revision: https://reviews.llvm.org/D37491 llvm-svn: 313796
* Add /System/Library/PrivateFrameworks as a header search path.Douglas Gregor2017-09-141-0/+1
| | | | | | Addresses rdar://problem/34438708. llvm-svn: 313317
* [MSan] Add flag to disable use-after-dtor.Matt Morehouse2017-09-141-1/+3
| | | | | | | | | | | | | | Summary: Flag is -fno-sanitize-use-after-dtor. Reviewers: vitalybuka, eugenis, kcc Reviewed By: vitalybuka, eugenis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37867 llvm-svn: 313314
* This adds the _Float16 preprocessor macro definitions.Sjoerd Meijer2017-09-131-14/+17
| | | | | | Differential Revision: https://reviews.llvm.org/D34695 llvm-svn: 313152
* IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.Peter Collingbourne2017-09-121-0/+1
| | | | | | | | This allows the flag to be persisted through to LTO. Differential Revision: https://reviews.llvm.org/D37655 llvm-svn: 313078
* Use the VFS from the CompilerInvocation by defaultRaphael Isemann2017-09-122-13/+11
| | | | | | | | | | | | | | | | | | | | | Summary: The CompilerInstance should create its default VFS from its CompilerInvocation. Right now the user has to manually create the VFS before creating the FileManager even though `-ivfsoverlay file.yaml` was passed via the CompilerInvocation (which is exactly how we worked around this issue in `FrontendAction.cpp` so far). This patch uses the invocation's VFS by default and also tests this behavior now from the point of view of a program that uses the clang API. Reviewers: benlangmuir, v.g.vassilev Reviewed By: v.g.vassilev Subscribers: mgorny, cfe-commits, v.g.vassilev Differential Revision: https://reviews.llvm.org/D37416 llvm-svn: 313049
* [PCH] Allow VFS to be used for tests that generate PCH filesCameron Desrochers2017-09-111-0/+36
| | | | | | | | | | | | | | | | | | | When using a virtual file-system (VFS) and a preamble file (PCH) is generated, it is generated on-disk in the real file-system instead of in the VFS (which makes sense, since the VFS is read-only). However, when subsequently reading the generated PCH, the frontend passes through the VFS it has been given -- resulting in an error and a failed parse (since the VFS doesn't contain the PCH; the real filesystem does). This patch fixes that by detecting when a VFS is being used for a parse that needs to work with a PCH file, and creating an overlay VFS that includes the PCH file from the real file-system. This allows tests to be written which make use of both PCH files and a VFS. Differential Revision: https://reviews.llvm.org/D37474 llvm-svn: 312917
* Fix ownership of the MemoryBuffer in a FrontendInputFile.Richard Smith2017-09-092-6/+7
| | | | | | | | This fixes a possible crash on certain kinds of corrupted AST file, but checking in an AST file corrupted in just the right way will be a maintenance nightmare because the format changes frequently. llvm-svn: 312851
* Fix templated type alias completion when using global completion cacheErik Verbruggen2017-09-081-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 } (This is the fixed version of r 311442, which was reverted in r311445.) Patch by Ivan Donchevskii! Differential Revision: https://reviews.llvm.org/D35355 llvm-svn: 312780
* [CUDA] When compilation fails, print the compilation mode.Justin Lebar2017-09-071-2/+11
| | | | | | | | | | | | | | | | | | Summary: That is, instead of "1 error generated", we now say "1 error generated when compiling for sm_35". This (partially) solves a usability foogtun wherein e.g. users call a function that's only defined on sm_60 when compiling for sm_35, and they get an unhelpful error message. Reviewers: tra Subscribers: sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D37548 llvm-svn: 312736
* [modules] Add ability to specify module name to module file mapping (reapply)Boris Kolpackov2017-08-313-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: 312220
* 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
OpenPOWER on IntegriCloud