summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Convert two more files that were using Windows line endings and removeChandler Carruth2019-01-191-1/+1
| | | | | | | a stray single '\r' from one file. These are the last line ending issues I can find in the files containing parts of LLVM's file headers. llvm-svn: 351634
* Remove random windows line endings that snuck into the middle of thisChandler Carruth2019-01-191-124/+124
| | | | | | code. llvm-svn: 351633
* Emit !callback metadata and introduce the callback attributeJohannes Doerfert2019-01-197-2/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | With commit r351627, LLVM gained the ability to apply (existing) IPO optimizations on indirections through callbacks, or transitive calls. The general idea is that we use an abstraction to hide the middle man and represent the callback call in the context of the initial caller. It is described in more detail in the commit message of the LLVM patch r351627, the llvm::AbstractCallSite class description, and the language reference section on callback-metadata. This commit enables clang to emit !callback metadata that is understood by LLVM. It does so in three different cases: 1) For known broker functions declarations that are directly generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel. 2) For known broker functions that are identified by their name and source location through the builtin detection, e.g., pthread_create from the POSIX thread API. 3) For user annotated functions that carry the "callback(callee, ...)" attribute. The attribute has to include the name, or index, of the callback callee and how the passed arguments can be identified (as many as the callback callee has). See the callback attribute documentation for detailed information. Differential Revision: https://reviews.llvm.org/D55483 llvm-svn: 351629
* [analyzer] pr37688: Fix a crash upon evaluating a deleted destructor of a union.Artem Dergachev2019-01-181-1/+14
| | | | | | | | | | | | | | | Add a defensive check against an invalid destructor in the CFG. Unions with fields with destructors have their own destructor implicitly deleted. Due to a bug in the CFG we're still trying to evaluate them at the end of the object's lifetime and crash because we are unable to find the destructor's declaration. rdar://problem/47362608 Differential Revision: https://reviews.llvm.org/D56899 llvm-svn: 351610
* [analyzer] Do not try to body-farm Objective-C properties with custom accessors.Artem Dergachev2019-01-181-0/+5
| | | | | | | | | | | | | | | | If a property is defined with a custom getter, we should not behave as if the getter simply returns an instance variable. We don't support setters, so they aren't affected. On top of being the right thing to do, this also fixes a crash on the newly added test - in which a property and its getter are defined in two separate categories. rdar://problem/47051544 Differential Revision: https://reviews.llvm.org/D56823 llvm-svn: 351609
* [ASTDump] NFC: Move variable into if() statementStephen Kelly2019-01-181-2/+1
| | | | llvm-svn: 351605
* [ASTDump] NFC: Remove redundant conditionStephen Kelly2019-01-181-4/+1
| | | | | | | | | | | These conditions are duplicated from the dumpDeclContext function called within the if(). This is presumably an attempt to avoid calling the function in the case it will do nothing. That may have made sense in the past if the code was different, but it doesn't make sense now. llvm-svn: 351604
* [ASTDump] NFC: Remove non-needed bracesStephen Kelly2019-01-181-3/+2
| | | | llvm-svn: 351603
* [ASTDump] Mark null params with a tag rather than a child nodeStephen Kelly2019-01-181-4/+9
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56753 llvm-svn: 351601
* [ASTDump] Mark BlockDecls which capture this with a tagStephen Kelly2019-01-181-3/+3
| | | | | | | | | | | | | | Summary: Removal of the child node makes it easier to separate traversal from output generation. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56752 llvm-svn: 351600
* [ASTDump] Mark variadic declarations with a tag instead of child nodeStephen Kelly2019-01-182-8/+8
| | | | | | | | | | | | | | Summary: This makes it easier to separate traversal of the AST from output generation. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56751 llvm-svn: 351597
* [Sema] Suppress a warning about a forward-declared fixed enum in C modeErik Pilkington2019-01-181-2/+1
| | | | | | | | | | | | | | | As of r343360, we support fixed-enums in C. This lead to some warnings in project headers where a fixed enum is forward declared then later defined. In C++, this is fine, the forward declaration is treated as a complete type even though the definition isn't present. We use this rule in C too, but still warn about the forward declaration anyways. This patch suppresses the warning. rdar://problem/47356469 Differential revision: https://reviews.llvm.org/D56879 llvm-svn: 351595
* [Fixed Point Arithmetic] Fixed Point Addition Constant Expression EvaluationLeonard Chan2019-01-183-58/+234
| | | | | | | | This patch includes logic for constant expression evaluation of fixed point additions. Differential Revision: https://reviews.llvm.org/D55868 llvm-svn: 351593
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-01-181-0/+2
| | | | llvm-svn: 351588
* [mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'Vladimir Stefanovic2019-01-181-0/+8
| | | | | | | | | | | These two options enable/disable emission of R_{MICRO}MIPS_JALR fixups along with PIC calls. The linker may then try to turn PIC calls into direct jumps. By default, these fixups do get emitted by the backend, use '-mno-relax-pic-calls' to omit them. Differential revision: https://reviews.llvm.org/D56878 llvm-svn: 351579
* [NFC] Fix wParentheses warning in ASTContext getFixedPointSemanticsErich Keane2019-01-181-3/+3
| | | | | Change-Id: I862f00a548236872fe24f7da8eb2bf7917e123ff llvm-svn: 351576
* Revert "Fix failing MSan bots"George Karpenkov2019-01-1812-204/+231
| | | | | | | | This reverts commit 2cedaaef383d8d6142046074ffebc2bb5a914778. Revert with a fix. llvm-svn: 351575
* [clang] Change to range-based invocation of llvm::sortMandeep Singh Grang2019-01-181-1/+1
| | | | llvm-svn: 351573
* [X86] Only define _XCR_XFEATURE_ENABLED_MASK in xsaveintrin.h when _MSC_VER ↵Craig Topper2019-01-182-2/+1
| | | | | | | | is defined. Remove from intrin.h. I think this was my intention when I added it xsaveintrin.h llvm-svn: 351568
* [clang][slh] add Clang attr no_speculative_load_hardeningZola Bridges2019-01-183-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This attribute will allow users to opt specific functions out of speculative load hardening. This compliments the Clang attribute named speculative_load_hardening. When this attribute or the attribute speculative_load_hardening is used in combination with the flags -mno-speculative-load-hardening or -mspeculative-load-hardening, the function level attribute will override the default during LLVM IR generation. For example, in the case, where the flag opposes the function attribute, the function attribute will take precendence. The sticky inlining behavior of the speculative_load_hardening attribute may cause a function with the no_speculative_load_hardening attribute to be tagged with the speculative_load_hardening tag in subsequent compiler phases which is desired behavior since the speculative_load_hardening LLVM attribute is designed to be maximally conservative. If both attributes are specified for a function, then an error will be thrown. Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54909 llvm-svn: 351565
* Revert "Clang side support for @cc assembly operands."Nirav Dave2019-01-181-52/+0
| | | | llvm-svn: 351561
* Clang side support for @cc assembly operands.Nirav Dave2019-01-181-0/+52
| | | | llvm-svn: 351559
* [OpenCL] Fix overloading ranking rules for addrspace conversions.Anastasia Stulova2019-01-181-1/+4
| | | | | | | | | Extend ranking to work with address spaces correctly when resolving overloads. Differential Revision: https://reviews.llvm.org/D56735 llvm-svn: 351546
* [tooling] Add a new argument adjuster for deleting plugin related command ↵Kadir Cetinkaya2019-01-181-0/+22
| | | | | | | | | | | | | | | | line args Summary: Currently both clangd and clang-tidy makes use of this mechanism so putting it into tooling so that all tools can make use of it. Reviewers: ilya-biryukov, sammccall Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D56856 llvm-svn: 351531
* Fix failing MSan botsVlad Tsyrklevich2019-01-1812-231/+204
| | | | | | | Revert r351508-351514, this block of changes introduced a consistent MSan failure on the sanitizer bots. llvm-svn: 351528
* [analyzer] Introduce proper diagnostic for freeing unowned objectGeorge Karpenkov2019-01-184-9/+32
| | | | | | | | Insert a note when the object becomes not (exclusively) owned. Differential Revision: https://reviews.llvm.org/D56891 llvm-svn: 351514
* [analyzer] Extend the PathDiagnosticLocation constructor to handle CallExitEndGeorge Karpenkov2019-01-183-30/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D56890 llvm-svn: 351513
* [analyzer] [NFC] Clean up messy handling of bug categories in RetainCountCheckerGeorge Karpenkov2019-01-184-150/+112
| | | | | | https://reviews.llvm.org/D56887 llvm-svn: 351512
* [analyzer] const-ify reference to bug type used in BugReporterGeorge Karpenkov2019-01-182-5/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D56885 llvm-svn: 351511
* [analyzer] Extend BugType constructor to accept "SuppressOnSink" as a parameterGeorge Karpenkov2019-01-186-20/+22
| | | | | | Differential Revision: https://reviews.llvm.org/D56884 llvm-svn: 351510
* [analyzer] [RetainCountChecker] Produce a correct message when OSTypeAlloc ↵George Karpenkov2019-01-181-1/+27
| | | | | | | | is used Differential Revision: https://reviews.llvm.org/D56820 llvm-svn: 351509
* [analyzer] [RetainCountChecker] Smart pointer support.George Karpenkov2019-01-182-2/+28
| | | | | | | | rdar://47323216 Differential Revision: https://reviews.llvm.org/D56817 llvm-svn: 351508
* [analyzer] MoveChecker: Add one more common resetting method, "append".Artem Dergachev2019-01-181-3/+3
| | | | | | | | | | | This is especially crucial for reports related to use-after-move of standard library objects. rdar://problem/47338505 Differential Revision: https://reviews.llvm.org/D56824 llvm-svn: 351500
* [analyzer] Make sure base-region and its sub-regions are either all alive or ↵Artem Dergachev2019-01-182-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | all dead. SymbolReaper now realizes that our liveness analysis isn't sharp enough to discriminate between liveness of, say, variables and their fields. Surprisingly, this didn't quite work before: having a variable live only through Environment (eg., calling a C++ method on a local variable as the last action ever performed on that variable) would not keep the region value symbol of a field of that variable alive. It would have been broken in the opposite direction as well, but both Environment and RegionStore use the scanReachableSymbols mechanism for finding live symbols regions within their values, and due to that they accidentally end up marking the whole chain of super-regions as live when at least one sub-region is known to be live. It is now a direct responsibility of SymbolReaper to maintain this invariant, and a unit test was added in order to make sure it stays that way. Differential Revision: https://reviews.llvm.org/D56632 rdar://problem/46914108 llvm-svn: 351499
* Fix cleanup registration for lambda captures.Richard Smith2019-01-174-31/+49
| | | | | | | | | | | | | | | | | Lambda captures should be destroyed if an exception is thrown only if the construction of the complete lambda-expression has not completed. (If the lambda-expression has been fully constructed, any exception will invoke its destructor, which will destroy the captures.) This is directly modeled after how we handle the equivalent situation in InitListExprs. Note that EmitLambdaLValue was unreachable because in C++11 onwards the frontend never creates the awkward situation where a prvalue expression (such as a lambda) is used in an lvalue context (such as the left-hand side of a class member access). llvm-svn: 351487
* Add -Wctad-maybe-unsupported to diagnose CTAD on types with no user defined ↵Eric Fiselier2019-01-171-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deduction guides. Summary: Some style guides want to allow using CTAD only on types that "opt-in"; i.e. on types that are designed to support it and not just types that *happen* to work with it. This patch implements the `-Wctad-maybe-unsupported` warning, which is off by default, which warns when CTAD is used on a type that does not define any deduction guides. The following pattern can be used to suppress the warning in cases where the type intentionally doesn't define any deduction guides: ``` struct allow_ctad_t; template <class T> struct TestSuppression { TestSuppression(T) {} }; TestSuppression(allow_ctad_t)->TestSuppression<void>; // guides with incomplete parameter types are never considered. ``` Reviewers: rsmith, james.dennett, gromer Reviewed By: rsmith Subscribers: jdennett, Quuxplusone, lebedev.ri, cfe-commits Differential Revision: https://reviews.llvm.org/D56731 llvm-svn: 351484
* Revert r351209 (which was a revert of r350891) with a fix.Aaron Ballman2019-01-172-118/+138
| | | | | | The test case had a parse error that was causing the condition string to be misreported. We now have better fallback code for error cases. llvm-svn: 351470
* [CodeGenObjC] Use a constant value for non-fragile ivar offsets when possibleErik Pilkington2019-01-171-11/+33
| | | | | | | | | | | | | | | If a class inherits from NSObject and has an implementation, then we can assume that ivar offsets won't need to be updated by the runtime. This allows us to index into the object using a constant value and avoid loading from the ivar offset variable. This patch was adapted from one written by Pete Cooper. rdar://problem/10132568 Differential revision: https://reviews.llvm.org/D56802 llvm-svn: 351461
* [ObjC] Follow-up r350768 and allow the use of unavailable methods that areAlex Lorenz2019-01-171-5/+3
| | | | | | | | | | | | | | | | declared in a parent class from within the @implementation context This commit extends r350768 and allows the use of methods marked as unavailable that are declared in a parent class/category from within the @implementation of the class where the method is marked as unavailable. This allows users to call init that's marked as unavailable even if they don't define it. rdar://47134898 Differential Revision: https://reviews.llvm.org/D56816 llvm-svn: 351459
* TLS: Respect visibility for thread_local variables on Darwin (PR40327)Vlad Tsyrklevich2019-01-171-4/+6
| | | | | | | | | | | | | | | | | | Summary: Teach clang to mark thread wrappers for thread_local variables with hidden visibility when the original variable is marked with hidden visibility. This is necessary on Darwin which exposes the thread wrapper instead of the thread variable. The thread wrapper would previously always be created with default visibility unless it had linkonce*/weak_odr linkage. Reviewers: rjmccall Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D56818 llvm-svn: 351457
* CodeGen: Cast llvm.flt.rounds result to match __builtin_flt_roundsAnton Korobeynikov2019-01-171-0/+11
| | | | | | | | | | | | | llvm.flt.rounds returns an i32, but the builtin expects an integer. On targets where integers are not 32-bits clang tries to bitcast the result, causing an assertion failure. The patch enables newlib build for msp430. Patch by Edward Jones! Differential Revision: https://reviews.llvm.org/D24461 llvm-svn: 351449
* [NewPM] Add -fsanitize={memory,thread} handling to clangPhilip Pfaffe2019-01-171-0/+11
| | | | | | | | | | | | Summary: This is the missing bit to drive thread and memory sanitizers through clang using the new PassManager. Reviewers: chandlerc, fedor.sergeev, vitalybuka, leonardchan Subscribers: bollu, llvm-commits Differential Revision: https://reviews.llvm.org/D56831 llvm-svn: 351423
* [X86] Add custom emission for the avx512 scatter builtins to convert from ↵Craig Topper2019-01-171-0/+108
| | | | | | scalar integer to vXi1 for the mask arguments to the intrinsics. llvm-svn: 351408
* [Frontend] Make WrapperFrontendAction call WrappedAction.PrepareToExecuteAction.Volodymyr Sapsai2019-01-171-0/+3
| | | | | | | | | | | | | | | | | Fixes `-emit-header-module` when GenerateHeaderModuleAction is wrapped by another frontend action. rdar://problem/47302588 Reviewers: rsmith, arphaman Reviewed By: arphaman Subscribers: jkorous, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D56766 llvm-svn: 351402
* [analyzer] Another RetainCountChecker cleanupGeorge Karpenkov2019-01-161-45/+33
| | | | | | | | | This is not NFC strictly speaking, since it unifies CleanupAttr handling, so that out parameters now also understand it. Differential Revision: https://reviews.llvm.org/D56759 llvm-svn: 351394
* [analyzer] [NFC] Yet another minor cleanup of RetainCountCheckerGeorge Karpenkov2019-01-162-33/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D56744 llvm-svn: 351393
* Recommit r351160 "[X86] Make _xgetbv/_xsetbv on non-windows platforms"Craig Topper2019-01-164-12/+30
| | | | | | V8 has been fixed now. llvm-svn: 351391
* [X86] Add versions of the avx512 gather intrinsics that take the mask as a ↵Craig Topper2019-01-161-0/+108
| | | | | | | | | | vXi1 vector instead of a scalar We need to custom handle these so we can turn the scalar mask into a vXi1 vector. Differential Revision: https://reviews.llvm.org/D56530 llvm-svn: 351390
* PR40329: [adl] Fix determination of associated classes when searching aRichard Smith2019-01-161-18/+16
| | | | | | | | | | | | | | | | | | | | | | | member enum and then its enclosing class. There are situations where ADL will collect a class but not the complete set of associated classes / namespaces of that class. When that happened, and we later tried to collect those associated classes / namespaces, we would previously short-circuit the lookup and not find them. Eg, for: struct A : B { enum E; }; if we first looked for associated classes/namespaces of A::E, we'd find only A. But if we then tried to also collect associated classes/namespaces of A (which should include the base class B), we would not add B because we had already visited A. This also fixes a minor issue where we would fail to collect associated classes from an overloaded class member access expression naming a static member function. llvm-svn: 351382
* [Fixed Point Arithmetic] Fixed Point SubtractionLeonard Chan2019-01-161-11/+64
| | | | | | | | | This patch covers subtraction between fixed point types and other fixed point types or integers, using the conversion rules described in 4.1.4 of N1169. Differential Revision: https://reviews.llvm.org/D55844 llvm-svn: 351371
OpenPOWER on IntegriCloud