summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [OPENMP] Simplify codegen for non-offloading code.Alexey Bataev2017-10-021-31/+20
| | | | | | | Simplified and generalized codegen for non-offloading part that works if offloading is failed or condition of the `if` clause is `false`. llvm-svn: 314670
* [CodeGen] Have a special function to get TBAA info for may-alias accessesIvan A. Kosarev2017-10-025-8/+23
| | | | | | | | | This is part of D37826 reworked to be a separate patch to simplify review. Differential Revision: https://reviews.llvm.org/D38408 llvm-svn: 314660
* [CodeGen] Do not refer to complete TBAA info where we actually deal with ↵Ivan A. Kosarev2017-10-029-58/+62
| | | | | | | | | | | | | | just TBAA access types This patch fixes misleading names of entities related to getting, setting and generation of TBAA access type descriptors. This is effectively an attempt to provide a review for D37826 by breaking it into smaller pieces. Differential Revision: https://reviews.llvm.org/D38404 llvm-svn: 314657
* Dependent Address Space SupportAndrew Gozillon2017-10-0213-44/+444
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* Test Commit.Andrew Gozillon2017-10-011-1/+0
| | | | llvm-svn: 314623
* [Analysis] Remove unused makeLvalueToRValue variant.Davide Italiano2017-09-301-13/+0
| | | | llvm-svn: 314605
* [NFC] Add assertion that we assume a valid macro argument index.Faisal Vali2017-09-301-0/+3
| | | | llvm-svn: 314600
* [NFC] Remove superfluous parameter Faisal Vali2017-09-302-7/+6
| | | | | | - MacroArgs already knows the maximum number of arguments that can be supplied to the macro. No need to pass MacroInfo (information about the macro definition) to the call to getPreExpArgument (which by the way might benefit from being called getExpandedArgument() ?) for it to compute the number of arguments. llvm-svn: 314593
* [ODRHash] Add base classes to hashing CXXRecordDecl.Richard Trieu2017-09-303-3/+132
| | | | llvm-svn: 314581
* [Analyzer] Synthesize function body for std::call_onceGeorge Karpenkov2017-09-301-28/+288
| | | | | | Differential Revision: https://reviews.llvm.org/D37840 llvm-svn: 314571
* Add a "vexing parse" warning for ambiguity between a variable declaration and aRichard Smith2017-09-291-0/+96
| | | | | | | | | | | | | | function-style cast. This fires for cases such as T(x); ... where 'x' was previously declared and T is a type. This construct declares a variable named 'x' rather than the (probably expected) interpretation of a function-style cast of 'x' to T. llvm-svn: 314570
* [PS4] Tidy up some debug-tuning v. triple decision-making.Paul Robinson2017-09-292-7/+11
| | | | llvm-svn: 314558
* [Sema] Correct IUnknown to support Unknwnbase.h Header.Erich Keane2017-09-291-3/+15
| | | | | | | | | | | | | | Apparently, the MSVC SDK has a strange implementation that causes a number of implicit functions as well as a template member function of the IUnknown type. This patch allows these as InterfaceLike types as well. Additionally, it corrects the behavior where extern-C++ wrapped around an Interface-Like type would permit an interface-like type to exist in a namespace. Differential Revision: https://reviews.llvm.org/D38303 llvm-svn: 314557
* [Sema] Suppress warnings for C's zero initializerDaniel Marjamaki2017-09-292-2/+16
| | | | | | | | Patch by S. Gilles! Differential Revision: https://reviews.llvm.org/D28148 llvm-svn: 314499
* [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / ↵Coby Tayree2017-09-292-44/+30
| | | | | | | | | | | immediate expressions Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized. supersedes D33278, D35774 Differential Revision: https://reviews.llvm.org/D37413 llvm-svn: 314494
* [NFC] Replace 'arguments' with 'parameters' in comments relating to lexing a ↵Faisal Vali2017-09-291-7/+7
| | | | | | macro definition. llvm-svn: 314484
* [NFC] Rename variable 'Arguments' to 'Parameters' when lexing the Macro ↵Faisal Vali2017-09-291-9/+9
| | | | | | Definition. llvm-svn: 314483
* [Sema] Put nullability fix-it after the end of the pointer.Volodymyr Sapsai2017-09-281-15/+22
| | | | | | | | | | | | | | | | | | Fixes nullability fix-it for `id<SomeProtocol>`. With this change nullability specifier is inserted after ">" instead of between "id" and "<". rdar://problem/34260995 Reviewers: jordan_rose, doug.gregor, ahatanak, arphaman Reviewed By: jordan_rose Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38327 llvm-svn: 314473
* [clang] Add getUnsignedPointerDiffType methodAlexander Shaposhnikov2017-09-283-5/+10
| | | | | | | | | | | | | | | | | C11 standard refers to the unsigned counterpart of the type ptrdiff_t in the paragraph 7.21.6.1p7 where it defines the format specifier %tu. In Clang (in PrintfFormatString.cpp, lines 508-510) there is a FIXME for this case, in particular, Clang didn't diagnose %tu issues at all, i.e. it didn't emit any warnings on the code printf("%tu", 3.14). In this diff we add a method getUnsignedPointerDiffType for getting the corresponding type similarly to how it's already done in the other analogous cases (size_t, ssize_t, ptrdiff_t etc) and fix -Wformat diagnostics for %tu plus the emitted fix-it as well. Test plan: make check-all Differential revision: https://reviews.llvm.org/D38270 llvm-svn: 314470
* Properly parse a postfix expression following a Boolean literal. Fixes PR34273.Aaron Ballman2017-09-281-1/+2
| | | | | | Patch by Nicolas Lesser. llvm-svn: 314463
* [Sema] Correct nothrow inherited by noexceptErich Keane2017-09-281-0/+3
| | | | | | | | | | | | | | | As reported in https://bugs.llvm.org/show_bug.cgi?id=33235, a noexcept function was unable to inherit from a nothrow defaulted constructor. Attribute "nothrow" is supposed to be semantically identical to noexcept, and in fact, a number of other places in the code treat them identically. This patch simply checks the RecordDecl for the correct attribute in the case where no other exception specifier was set. Differential Revision: https://reviews.llvm.org/D38209 llvm-svn: 314462
* [Sema] Warn on attribute nothrow conflicting with language specifiersErich Keane2017-09-281-1/+20
| | | | | | | | | | | | | | I discovered it was possible to create a 'nothrow' noexcept(false) function, which is both non-sensical as well as seemingly breaking. This patch warns if attribute nothrow is used with anything besides "noexcept". "noexcept(true)" isn't possible, because the noexcept decl isn't parsed until later. Differential Revision: https://reviews.llvm.org/D38205 llvm-svn: 314461
* [AMDGPU] Allow flexible register names in inline asm constraintsYaxun Liu2017-09-281-6/+73
| | | | | | | | | | | | | | | | | | | | | | | | Currently AMDGPU inline asm only allow v and s as register names in constraints. This patch allows the following register names in constraints: (n, m is unsigned integer, n < m) v s {vn} or {v[n]} {sn} or {s[n]} {S} , where S is a special register name {v[n:m]} {s[n:m]} Differential Revision: https://reviews.llvm.org/D37568 llvm-svn: 314452
* [DWARF] Allow forward declarations of a class template instantiationPaul Robinson2017-09-283-0/+10
| | | | | | | | | 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
* Consolidate std::move() detection code. No behavior change.Nico Weber2017-09-285-31/+13
| | | | llvm-svn: 314427
* Fix -Wcast-qual warning after r314336.Nico Weber2017-09-281-1/+1
| | | | llvm-svn: 314424
* Use std::is_trivial instead of is_trivially_copyable.Benjamin Kramer2017-09-281-2/+2
| | | | | | | | The oldest versions of GCC we support (before 5) didn't support that trait. is_trivial is stronger superset that clang::Token fulfills, so just use that instead. llvm-svn: 314391
* [NFC] Don't use C++17 standard lib variable template helper traits, instead ↵Faisal Vali2017-09-281-2/+2
| | | | | | use ::value. llvm-svn: 314373
* [NFC] Modernize MacroArgs using TrailingObjectsFaisal Vali2017-09-281-10/+15
| | | | | | Refactor MacroArgs to use TrailingObjects when creating a variably sized object on the heap to store the unexpanded tokens immediately after the MacroArgs object. llvm-svn: 314372
* Look through parentheses.Akira Hatanaka2017-09-281-1/+1
| | | | | | | | | This fixes a bug where clang would emit instructions to reclaim a value that's going to be __bridge-casted to CF. rdar://problem/34687542 llvm-svn: 314370
* [Targets/X86] Remove unneded `return` in setMaxAtomicWidth(). NFCI.Davide Italiano2017-09-281-1/+0
| | | | llvm-svn: 314367
* [Preprocessor] Preserve #pragma clang assume_nonnull in preprocessed outputEli Friedman2017-09-272-0/+23
| | | | | | | | Patch by Zbigniew Sarbinowski! Differential Revision: https://reviews.llvm.org/D37861 llvm-svn: 314364
* [AVR] Update data layout to match current LLVM trunkDylan McKay2017-09-271-2/+1
| | | | | | The data layout was changed in r314179 to fix atomic loads and stores. llvm-svn: 314354
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-272-98/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExternalASTMerger has hitherto relied on being able to look up any Decl through its named DeclContext chain. This works for many cases, but causes problems for function-local structs, which cannot be looked up in their containing FunctionDecl. An example case is void f() { { struct S { int a; }; } { struct S { bool b; }; } } It is not possible to lookup either of the two Ses individually (or even to provide enough information to disambiguate) after parsing is over; and there is typically no need to, since they are invisible to the outside world. However, ExternalASTMerger needs to be able to complete either S on demand. This led to an XFAIL on test/Import/local-struct, which this patch removes. The way the patch works is: It defines a new data structure, ExternalASTMerger::OriginMap, which clients are expected to maintain (default-constructing if the origin does not have an ExternalASTMerger servicing it) As DeclContexts are imported, if they cannot be looked up by name they are placed in the OriginMap. This allows ExternalASTMerger to complete them later if necessary. As DeclContexts are imported from an origin that already has its own OriginMap, the origins are forwarded – but only for those DeclContexts that are actually used. This keeps the amount of stored data minimal. The patch also applies several improvements from review: - Thoroughly documents the interface to ExternalASTMerger; - Adds optional logging to help track what's going on; and - Cleans up a bunch of braces and dangling elses. Differential Revision: https://reviews.llvm.org/D38208 llvm-svn: 314336
* [CUDA] Work around conflicting function definitions in CUDA-9 headers.Artem Belevich2017-09-271-0/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D38326 llvm-svn: 314334
* [OpenMP] Fix translation of target argsJonas Hahnfeld2017-09-271-4/+6
| | | | | | | | | | ToolChain::TranslateArgs() returns nullptr if no changes are performed. This would currently mean that OpenMPArgs are lost. Patch fixes this by falling back to simply using OpenMPArgs in that case. Differential Revision: https://reviews.llvm.org/D38259 llvm-svn: 314330
* [OpenMP] Fix passing of -m arguments to device toolchainJonas Hahnfeld2017-09-271-6/+9
| | | | | | | | | | | AuxTriple is not set if host and device share a toolchain. Also, removing an argument modifies the DAL which needs to be returned for future use. (Move tests back to offload-openmp.c as they are not related to GPUs.) Differential Revision: https://reviews.llvm.org/D38258 llvm-svn: 314329
* [OpenMP] Fix memory leak when translating argumentsJonas Hahnfeld2017-09-272-5/+13
| | | | | | | | | | Parsing the argument after -Xopenmp-target allocates memory that needs to be freed. Associate it with the final DerivedArgList after we know which one will be used. Differential Revision: https://reviews.llvm.org/D38257 llvm-svn: 314328
* clang-format/java: Unbreak genenrics formatting after r299952.Nico Weber2017-09-272-6/+2
| | | | | | | | | | | | | | https://reviews.llvm.org/rL299952 merged '>>>' tokens into a single JavaRightLogicalShift token. This broke formatting of generics nested more than two deep, e.g. Foo<Bar<Baz>>> because the '>>>' now weren't three '>' for parseAngle(). Luckily, just deleting JavaRightLogicalShift fixes things without breaking the test added in r299952, so do that. https://reviews.llvm.org/D38291 llvm-svn: 314325
* [OpenCL] Handle address space conversion while setting type alignment.Anastasia Stulova2017-09-272-2/+12
| | | | | | | | | Added missing addrspacecast case in alignment computation logic of pointer type emission in IR generation. Differential Revision: https://reviews.llvm.org/D37804 llvm-svn: 314304
* [analyzer] Match more patterns in bugreporter::getDerefExpr() API.Artem Dergachev2017-09-271-5/+17
| | | | | | | | | | This function can now track null pointer through simple pointer arithmetic, such as '*&*(p + 2)' => 'p' and so on, displaying intermediate diagnostic pieces for the user to understand where the null pointer is coming from. Differential Revision: https://reviews.llvm.org/D37025 llvm-svn: 314290
* [analyzer] Fix and refactor bugreporter::getDerefExpr() API.Artem Dergachev2017-09-271-30/+50
| | | | | | | | | | | | | | | | | | | | This API is used by checkers (and other entities) in order to track where does a value originate from, by jumping from an expression value of which is equal to that value to the expression from which this value has "appeared". For example, it may be an lvalue from which the rvalue was loaded, or a function call from which the dereferenced pointer was returned. The function now avoids incorrectly unwrapping implicit lvalue-to-rvalue casts, which caused crashes and incorrect intermediate diagnostic pieces. It also no longer relies on how the expression is written when guessing what it means. Fixes pr34373 and pr34731. rdar://problem/33594502 Differential Revision: https://reviews.llvm.org/D37023 llvm-svn: 314287
* [clang-format] Fix FixNamespaceComments when BraceWrapping AfterNamespace is ↵Marek Kurdej2017-09-271-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | true. Summary: NamespaceEndCommentsFixer did not fix namespace comments when the brace opening the namespace was not on the same line as the "namespace" keyword. It occurs in Allman, GNU and Linux styles and whenever BraceWrapping.AfterNamespace is true. Before: ```lang=cpp namespace a { void f(); void g(); } ``` After: ```lang=cpp namespace a { void f(); void g(); } // namespace a ``` Reviewers: krasimir Reviewed By: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D37904 llvm-svn: 314279
* Fix capitalization of a bunch of parameters in SemaDeclAttr [NFC]Erich Keane2017-09-271-44/+44
| | | | llvm-svn: 314267
* [clang-format] Adjust space around &/&& of structured bindingsChih-Hung Hsieh2017-09-271-4/+12
| | | | | | | | | | | Keep space before or after the &/&& tokens, but not both. For example, auto [x,y] = a; auto &[xr, yr] = a; // LLVM style auto& [xr, yr] = a; // google style Differential Revision:https://reviews.llvm.org/D35743 llvm-svn: 314264
* Emit section information for extern variables. Erich Keane2017-09-262-0/+16
| | | | | | | | | | | | | | | | | Currently, if _attribute_((section())) is used for extern variables, section information is not emitted in generated IR when the variables are used. This is expected since sections are not generated for external linkage objects. However NiosII requires this information as it uses special GP-relative accesses for any objects that use attribute section (.sdata). GCC keeps this attribute in middle-end. This change emits the section information for all targets. Patch By: Elizabeth Andrews Differential Revision:https://reviews.llvm.org/D36487 llvm-svn: 314262
* Fix uninitialized member found by msan build bot.Richard Smith2017-09-261-1/+1
| | | | llvm-svn: 314246
* Sema: rename SemaBuiltinVAStart to SemaBuiltinVAStartMicrosoftSaleem Abdulrasool2017-09-261-2/+2
| | | | | | | | | | | This function is used to perform semantic analysis on Microsoft style `__va_start`. Rename it to make this more explicit. `__va_start` is marked as `ALL_MS_LANGUAGES`, and requires Microsoft compatibility. Other GNU targets will use `__builtin_va_start` instead. NFC. Addresses post-commit review comments from David Majnemer. llvm-svn: 314241
* Basic: support Preserve{Most,All} CC on WindowsSaleem Abdulrasool2017-09-262-0/+4
| | | | | | | Add support for the `preserve_mostcc` and `preserve_allcc` on Windows x86_64 and AArch64. This is used by Swift. llvm-svn: 314236
* Allow IUnknown/IInterface types to come from extern C++ Erich Keane2017-09-261-1/+2
| | | | | | | | | | | | It was brought up in response to my last implementation for this struct-as-interface features that at least 1 header in the MS SDK uses "extern C++" around an IUnknown declaration. The previous implementation demanded that this type exist in the TranslationUnit DeclContext. This small change simply also allows in the situation where we're extern "C++". llvm-svn: 314235
OpenPOWER on IntegriCloud