summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* [CUDA] Add option to generate relocatable device codeJonas Hahnfeld2018-02-121-0/+2
| | | | | | | | | | | As a first step, pass '-c/--compile-only' to ptxas so that it doesn't complain about references to external function. This will successfully generate object files, but they won't work at runtime because the registration routines need to adapted. Differential Revision: https://reviews.llvm.org/D42921 llvm-svn: 324878
* Make a build bot happy.Gabor Horvath2018-02-101-6/+6
| | | | llvm-svn: 324809
* [Templight] Template Instantiation ObserverGabor Horvath2018-02-102-0/+156
| | | | | | | | | | | | | | | | | | | | | This patch adds a base-class called TemplateInstantiationObserver which gets notified whenever a template instantiation is entered or exited during semantic analysis. This is a base class used to implement the template profiling and debugging tool called Templight (https://github.com/mikael-s-persson/templight). The patch also makes a few more changes: * ActiveTemplateInstantiation class is moved out of the Sema class (so it can be used with inclusion of Sema.h). * CreateFrontendAction function in front-end utilities is given external linkage (not longer a hidden static function). * TemplateInstObserverChain data member added to Sema class to hold the list of template-inst observers. * Notifications to the template-inst observer are added at the key places where templates are instantiated. Patch by: Abel Sinkovics! Differential Revision: https://reviews.llvm.org/D5767 llvm-svn: 324808
* [analyzer] Show full analyzer invocation for reproducibility in HTML reportsGeorge Karpenkov2018-01-231-0/+8
| | | | | | | | | | | | Analyzing problems which appear in scan-build results can be very difficult, as after the launch no exact invocation is stored, and it's super-hard to launch the debugger. With this patch, the exact analyzer invocation appears in the footer, and can be copied to debug/check reproducibility/etc. rdar://35980230 llvm-svn: 323245
* [Solaris] gcc toolchain handling revampFedor Sergeev2018-01-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: General idea is to utilize generic (mostly Generic_GCC) code and get rid of Solaris-specific handling as much as possible. In particular: - scanLibDirForGCCTripleSolaris was removed, relying on generic CollectLibDirsAndTriples - findBiarchMultilibs is now properly utilized to switch between m32 and m64 include & lib paths on Solaris - C system include handling copied from Linux (bar multilib hacks) Fixes PR24606. Reviewers: dlj, rafael, jyknight, theraven, tstellar Reviewed By: jyknight Subscribers: aaron.ballman, mgorny, krytarowski, ro, joerg, cfe-commits Differential Revision: https://reviews.llvm.org/D35755 llvm-svn: 323193
* [Frontend] Allow to use PrecompiledPreamble without calling CanReuseIlya Biryukov2018-01-181-13/+29
| | | | | | | | | | | | | | | | | | | Summary: The new method 'OverridePreamble' allows to override the preamble of any source file without checking if preamble bounds or dependencies were changed. This is used for completion in clangd. Reviewers: bkramer, sammccall Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41990 llvm-svn: 322853
* Use an enum value instead of a string.Rafael Espindola2018-01-182-6/+14
| | | | | | | | The old StringSwitch use was also broken. It assumed that a StringSwitch returns Optional<T> instead of T and was missing a .Default. llvm-svn: 322792
* Revert 319303: Add _Float128 as alias to __float128 to enable compilations ↵Erich Keane2018-01-151-4/+0
| | | | | | | | on Fedora27/glibc2 Differential Revision: https://reviews.llvm.org/D40673 llvm-svn: 322518
* [CodeComplete] Add an option to omit results from the preamble.Sam McCall2018-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: Enumerating the contents of a namespace or global scope will omit any decls that aren't already loaded, instead of deserializing them from the PCH. This allows a fast hybrid code completion where symbols from headers are provided by an external index. (Sema already exposes the information needed to do a reasonabl job of filtering them). Clangd plans to implement this hybrid. This option is just a hint - callers still need to postfilter results if they want to *avoid* completing decls outside the main file. Reviewers: bkramer, ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41989 llvm-svn: 322371
* Reland "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-091-0/+2
| | | | | | | | | | | | | | | | | Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. The original patch didn't have the lit.local.cfg file that restricts the new test to x86, thus the new test was failing on the non-x86 bots. Differential Revision: https://reviews.llvm.org/D40531 The reverts r322008, which was a revert of r322005. This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba. llvm-svn: 322136
* [Frontend] Remove unused FileMgr in pp arg parseBrian Gesiak2018-01-091-7/+1
| | | | | | | | | | | | | | | | | | | | | Summary: A FIXME added 8 years ago (2010) in https://reviews.llvm.org/rL118203 mentioned that a FileManager should not need to be used when parsing preprocessor arguments. In fact, its only use was removed 6 years ago (2012), in https://reviews.llvm.org/rL166452. Remove the unused variable and the obsolete FIXME. Test Plan: `check-clang` Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41867 llvm-svn: 322118
* Track in the AST whether the operand to a UnaryOperator can overflow and ↵Aaron Ballman2018-01-092-24/+29
| | | | | | then use that logic when evaluating constant expressions and emitting codegen. llvm-svn: 322074
* Added Control Flow Protection FlagOren Ben Simhon2018-01-091-0/+15
| | | | | | | | | | Cf-protection is a target independent flag that instructs the back-end to instrument control flow mechanisms like: Branch, Return, etc. For example in X86 this flag will be used to instrument Indirect Branch Tracking instructions. Differential Revision: https://reviews.llvm.org/D40478 Change-Id: I5126e766c0e6b84118cae0ee8a20fe78cc373dea llvm-svn: 322063
* Revert "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-081-2/+0
| | | | | | | | | | The new test fails on the Hexagon bot. Reverting while I investigate. This reverts https://reviews.llvm.org/rL322005 This reverts commit b7e0026b4385180c378edc658ec91a39566f2942. llvm-svn: 322008
* Emit Function IDs table for Control Flow GuardAdrian McCarthy2018-01-081-0/+2
| | | | | | | | | | Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. Differential Revision: https://reviews.llvm.org/D40531 llvm-svn: 322005
* [Driver] Add flag enabling the function stack size section that was added in ↵Sean Eveson2018-01-081-0/+2
| | | | | | | | | | r319430 Adds the -fstack-size-section flag to enable the .stack_sizes section. The flag defaults to on for the PS4 triple. Differential Revision: https://reviews.llvm.org/D40712 llvm-svn: 321992
* [Driver] Suggest correctly spelled driver optionsBrian Gesiak2018-01-061-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Depends on https://reviews.llvm.org/D41732. Utilities such as `opt`, when invoked with arguments that are very nearly spelled correctly, suggest the correctly spelled options: ``` bin/opt -hel opt: Unknown command line argument '-hel'. Try: 'bin/opt -help' opt: Did you mean '-help'? ``` Clang, on the other hand, prior to this commit, does not: ``` bin/clang -hel clang-6.0: error: unknown argument: '-hel' ``` This commit makes use of the new libLLVMOption API from https://reviews.llvm.org/D41732 in order to provide correct suggestions: ``` bin/clang -hel clang-6.0: error: unknown argument: '-hel', did you mean '-help'? ``` Test Plan: `check-clang` Reviewers: yamaguchi, v.g.vassilev, teemperor, ruiu, bruno Reviewed By: bruno Subscribers: bruno, jroelofs, cfe-commits Differential Revision: https://reviews.llvm.org/D41733 llvm-svn: 321917
* Track shadow modules with a generation counter.Bruno Cardoso Lopes2018-01-051-0/+7
| | | | | | | | | | This is a follow up to r321855, closing the gap between our internal shadow modules implementation and upstream. It has been tested for longer and provides a better approach for tracking shadow modules. Mostly NFCI. rdar://problem/23612102 llvm-svn: 321906
* Calculate size of buffer instead of using a magic value.Paul Robinson2018-01-031-1/+1
| | | | | | | | Patch by Matthew Davis! Differential Revision: https://reviews.llvm.org/D41421 llvm-svn: 321757
* [OPENMP] Initial support for `-fopenmp-simd` option.Alexey Bataev2017-12-292-6/+12
| | | | | | Added basic support for `-fopenmp-simd` options. llvm-svn: 321558
* [Modules] Map missing private submodules from Foo.Private to Foo_PrivateBruno Cardoso Lopes2017-12-221-2/+36
| | | | | | | | | | | | | | In case `@import Foo.Private` fails because the submodule doesn't exist, look for `Foo_Private` (if available) and build/load that module instead. In that process emit a warning and tell the user about the assumption. The intention here is to assist all existing private modules owners (in ObjC and Swift) to migrate to the new `Foo_Private` syntax. rdar://problem/36023940 llvm-svn: 321342
* Added helper to get size of PrecompiledPreambleIlya Biryukov2017-12-211-3/+24
| | | | llvm-svn: 321266
* [clang] Add BeforeExecute method to PrecompiledPreambleIlya Biryukov2017-12-201-0/+2
| | | | | | | | | | | | | | | | | Summary: Adds BeforeExecute method to PrecompiledPreamble to be called before Execute(). This method can be overriden. Patch by William Enright. Reviewers: malaperle, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: arphaman, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D41365 llvm-svn: 321189
* [Driver, CodeGen] pass through and apply -fassociative-mathSanjay Patel2017-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 parts to getting the -fassociative-math command-line flag translated to LLVM FMF: 1. In the driver/frontend, we accept the flag and its 'no' inverse and deal with the interactions with other flags like -ffast-math -fno-signed-zeros -fno-trapping-math. This was mostly already done - we just need to translate the flag as a codegen option. The test file is complicated because there are many potential combinations of flags here. Note that we are matching gcc's behavior that requires 'nsz' and no-trapping-math. 2. In codegen, we map the codegen option to FMF in the IR builder. This is simple code and corresponding test. For the motivating example from PR27372: float foo(float a, float x) { return ((a + x) - x); } $ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math -emit-llvm | egrep 'fadd|fsub' %add = fadd nnan ninf nsz arcp contract float %0, %1 %sub = fsub nnan ninf nsz arcp contract float %add, %2 So 'reassoc' is off as expected (and so is the new 'afn' but that's a different patch). This case now works as expected end-to-end although the underlying logic is still wrong: $ ./clang -O2 27372.c -S -o - -ffast-math -fno-associative-math | grep xmm addss %xmm1, %xmm0 subss %xmm1, %xmm0 We're not done because the case where 'reassoc' is set is ignored by optimizer passes. Example: $ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math -emit-llvm | grep fadd %add = fadd reassoc float %0, %1 $ ./clang -O2 27372.c -S -o - -fassociative-math -fno-signed-zeros -fno-trapping-math | grep xmm addss %xmm1, %xmm0 subss %xmm1, %xmm0 Differential Revision: https://reviews.llvm.org/D39812 llvm-svn: 320920
* [VerifyDiagnosticConsumer] support -verify=<prefixes>Hal Finkel2017-12-162-41/+122
| | | | | | | | | | | | | | | | | | | | This mimics FileCheck's --check-prefixes option. The default prefix is "expected". That is, "-verify" is equivalent to "-verify=expected". The goal is to permit exercising a single test suite source file with different compiler options producing different sets of diagnostics. While cpp can be combined with the existing -verify to accomplish the same goal, source is often easier to maintain when it's not cluttered with preprocessor directives or duplicate passages of code. For example, this patch also rewrites some existing clang tests to demonstrate the benefit of this feature. Patch by Joel E. Denny, thanks! Differential Revision: https://reviews.llvm.org/D39694 llvm-svn: 320908
* [TextDiagnosticBuffer] Fix diagnostic note emission orderHal Finkel2017-12-161-13/+24
| | | | | | | | | | | | The frontend currently groups diagnostics from the command line according to diagnostic level, but that places all notes last. Fix that by emitting such diagnostics in the order they were generated. Patch by Joel E. Denny, thanks! Differential Revision: https://reviews.llvm.org/D40995 llvm-svn: 320904
* [clang] Add PPCallbacks list to preprocessor when building a preacompiled ↵Ilya Biryukov2017-12-152-20/+10
| | | | | | | | | | | | | | | | | | | | preamble. Summary: Revision D38639 needs this commit in order to properly make open definition calls on include statements work. Patch by William Enright. Reviewers: malaperle, krasimir, bkramer, ilya-biryukov Reviewed By: malaperle, ilya-biryukov Subscribers: cfe-commits, arphaman, ilya-biryukov Differential Revision: https://reviews.llvm.org/D39375 llvm-svn: 320804
* [Sema] Ignore decls in namespaces when global decls are not wanted.Eric Liu2017-12-131-0/+2
| | | | | | | | | | | | | | Summary: ... in qualified code completion and decl lookup. Reviewers: ilya-biryukov, arphaman Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40562 llvm-svn: 320563
* [Driver][CodeGen] Add -mprefer-vector-width driver option and attribute ↵Craig Topper2017-12-111-0/+2
| | | | | | | | | | | | | | | | during CodeGen. This adds a new command line option -mprefer-vector-width to specify a preferred vector width for the vectorizers. Valid values are 'none' and unsigned integers. The driver will check that it meets those constraints. Specific supported integers will be managed by the targets in the backend. Clang will take the value and add it as a new function attribute during CodeGen. This represents the alternate direction proposed by Sanjay in this RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118734.html The syntax here matches gcc, though gcc treats it as an x86 specific command line argument. gcc only allows values of 128, 256, and 512. I'm not having clang check any values. Differential Revision: https://reviews.llvm.org/D40230 llvm-svn: 320419
* Revert 320391: Certain targets are failing, pulling back to diagnose.Erich Keane2017-12-112-20/+0
| | | | llvm-svn: 320398
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-12-112-0/+20
| | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Note: this is a recommit after a test failure took down the original (r318669) Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 320391
* Switch to gnu++14 as the default dialect.Tim Northover2017-12-091-5/+1
| | | | | | This is C++14 with conforming GNU extensions. llvm-svn: 320250
* Correct line endings that got mixed up in r320089; NFC.Aaron Ballman2017-12-072-412/+412
| | | | llvm-svn: 320113
* Add new language mode flags for C17.Aaron Ballman2017-12-072-401/+404
| | | | | | This adds -std=c17, -std=gnu17, and -std=iso9899:2017 as language mode flags for C17 and updates the value of __STDC_VERSION__ to the value based on the C17 FDIS. Given that this ballot cannot succeed until 2018, it is expected that we (and GCC) will add c18 flags as aliases once the ballot passes. llvm-svn: 320089
* [driver] Set the 'simulator' environment for Darwin when compiling forAlex Lorenz2017-12-071-0/+5
| | | | | | | | | | iOS/tvOS/watchOS simulator rdar://35135215 Differential Revision: https://reviews.llvm.org/D40682 llvm-svn: 320073
* Add __WINT_MAX__.Ed Schouten2017-12-051-0/+1
| | | | | | | This definition is similar to __WCHAR_MAX__, except that it applies to wint_t. It's also documented as being supported by GCC 4.5 and later. llvm-svn: 319746
* Generalize "static data member instantiated" notification to cover variable ↵Richard Smith2017-12-051-10/+15
| | | | | | | | | templates too. While here, split the "point of instantiation changed" notification out from it; these two really are orthogonal changes. llvm-svn: 319727
* Add _Float128 as alias to __float128 to enable compilations on ↵Erich Keane2017-12-041-0/+4
| | | | | | | | | | | | | | | | | Fedora27/glibc2-26 Fedora27 is using a new version of glibc that refers to the _Float128 type. This patch adds that name as an alias to float128. I also added some predefined macro values for the digits, mantissa, epilon, etc (FloatMacros). For the test case, I copied an existing float128 test. This functionality needs work long term, but it should be sufficient to tread water for a while. At Intel we have test servers running our LLVM compiler with various open source workloads, the server has been upgraded to Fedora27 so many workloads are failing due to _Float128. Patch-By: mibintc Differential Revision: https://reviews.llvm.org/D40673 llvm-svn: 319703
* Now that C++17 is official (https://www.iso.org/standard/68564.html), start ↵Aaron Ballman2017-12-042-8/+8
| | | | | | changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. llvm-svn: 319688
* [OpenCL] Define __IMAGE_SUPPORT__ macro for SPIRSven van Haastregt2017-12-041-0/+4
| | | | | | | | | | | Add #define __IMAGE_SUPPORT__ 1 for SPIR targets to indicate that SPIR supports images. Patch by Dmitry Borisenkov. Differential Revision: https://reviews.llvm.org/D40252 llvm-svn: 319658
* [XRay][clang] Introduce -fxray-always-emit-customeventsDean Michael Berris2017-11-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The -fxray-always-emit-customevents flag instructs clang to always emit the LLVM IR for calls to the `__xray_customevent(...)` built-in function. The default behaviour currently respects whether the function has an `[[clang::xray_never_instrument]]` attribute, and thus not lower the appropriate IR code for the custom event built-in. This change allows users calling through to the `__xray_customevent(...)` built-in to always see those calls lowered to the corresponding LLVM IR to lay down instrumentation points for these custom event calls. Using this flag enables us to emit even just the user-provided custom events even while never instrumenting the start/end of the function where they appear. This is useful in cases where "phase markers" using __xray_customevent(...) can have very few instructions, must never be instrumented when entered/exited. Reviewers: rnk, dblaikie, kpw Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40601 llvm-svn: 319388
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-292-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-apply of r319294. adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319297
* Revert "Toolchain: Normalize dwarf, sjlj and seh eh"Martell Malone2017-11-292-18/+1
| | | | | | | | This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 llvm-svn: 319295
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-292-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 clang cc1 assumes dwarf is the default if none is passed and -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319294
* Avoid copying the data of in-memory preamblesIlya Biryukov2017-11-241-3/+1
| | | | | | | | | | | | | | Summary: Preambles are large and we should avoid copying them. Reviewers: bkramer, klimek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40302 llvm-svn: 318945
* Add -finstrument-function-entry-bare flagHans Wennborg2017-11-211-0/+2
| | | | | | | | | | | | | | | | | This is an instrumentation flag that's similar to -finstrument-functions, but it only inserts calls on function entry, the calls are inserted post-inlining, and they don't take any arugments. This is intended for users who want to instrument function entry with minimal overhead. (-pg would be another alternative, but forces frame pointer emission and affects link flags, so is probably best left alone to be used for generating gcov data.) Differential revision: https://reviews.llvm.org/D40276 llvm-svn: 318785
* Revert r318669/318694Erich Keane2017-11-202-20/+0
| | | | | | Broke some libclang tests, so reverting for now. llvm-svn: 318698
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-11-202-0/+20
| | | | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 318669
* [CodeGen] Move Reciprocals option from TargetOptions to CodeGenOptionsCraig Topper2017-11-201-1/+1
| | | | | | Diffrential Revision: https://reviews.llvm.org/D40226 llvm-svn: 318662
* [Driver] Add a cc1 flag for the new TBAA metadata formatIvan A. Kosarev2017-11-201-0/+2
| | | | | | | | | | | This patch starts a series of changes to add support for the new TBAA metadata format proposed in this llvm-dev thread: http://lists.llvm.org/pipermail/llvm-dev/2017-November/118748.html Differential Revision: https://reviews.llvm.org/D39955 llvm-svn: 318644
OpenPOWER on IntegriCloud