summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* [Sema] Allow an external sema source to handle delayed typo corrections.Benjamin Kramer2016-05-191-2/+10
| | | | | | | This probably isn't perfectly perfect but allows correcting function calls again. llvm-svn: 270039
* Fix PR27601 by reverting [r267453] - Refactor traversal of bases in ↵Faisal Vali2016-05-191-26/+45
| | | | | | | | | | | | deduction of template parameters from base This reversal is being done with r267453's author's (i.e. Richard Smith's) permission. This fixes https://llvm.org/bugs/show_bug.cgi?id=27601 Also, per Richard's request the examples from the bug report have been added to our test suite. llvm-svn: 270016
* Make Sema::getPrintingPolicy less ridiculously expensive. This used to performRichard Smith2016-05-192-5/+5
| | | | | | | | | | an identifier table lookup, *and* copy the LangOptions (including various std::vector<std::string>s). Twice. We call this function once each time we start parsing a declaration specifier sequence, and once for each call to Sema::Diag. This reduces the compile time for a sample .c file from the linux kernel by 20%. llvm-svn: 270009
* ObjectiveC Class Properties: warn if a class property accessor is mistakenly anManman Ren2016-05-181-12/+16
| | | | | | | | | | | | | instance method. When diagnosing unimplemented class property, make sure we emit a warning when we only see an instance method with the right selector. Also warn when we only see a class method for an instance property. rdar://26141719 llvm-svn: 269968
* Teach Sema::MergeFunctionDecl to properly check for an out-of-line ↵Vassil Vassilev2016-05-181-1/+1
| | | | | | | | | | | | definition of a function that is declared as =default in its class definition. First part of PR27699. Patch by Cristina Cristescu! Reviewed by Richard Smith and me. llvm-svn: 269935
* Support for MSVS default calling convention options (/Gd, /Gz, /Gv,Alexey Bataev2016-05-181-5/+6
| | | | | | | | | /Gr), by Alexander Makarov Patch for bug #27711 Differential Revision: http://reviews.llvm.org/D20171 llvm-svn: 269891
* [Sema,CodeGen] Remove comment from SemaChecking about a ↵Craig Topper2016-05-181-2/+1
| | | | | | | | builtin_shufflevector form that it doesn't support. Remove CodeGen support for the same form since it could never have been used due to the missing support in Sema. I couldn't find any documentation that this form existed either. Nor is there documentation for one of the remaining two forms, but there is a testcase that uses it. llvm-svn: 269879
* [X86] Add immediate range checks for many of the builtins.Craig Topper2016-05-181-33/+241
| | | | | | This time allow -128 to 255 for builtins that use a char type immediate." llvm-svn: 269878
* Revert "[X86] Add immediate range checks for many of the builtins."Filipe Cabecinhas2016-05-171-234/+32
| | | | | | This reverts commit r269619. llvm-svn: 269765
* [OPENMP] Pass scalar firstprivate vars by value.Alexey Bataev2016-05-174-171/+175
| | | | | | | | For better performance and to unify code with offloading part we pass scalar firstprivate values by value, instead of by reference. It will remove some extra copying operations. llvm-svn: 269751
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-161-1/+7
| | | | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Re-commit after fixing build error due to missing override attribute. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269670
* [X86] Add immediate range checks for many of the builtins.Craig Topper2016-05-151-32/+234
| | | | llvm-svn: 269619
* Warn when a reference is bound to an empty l-value (dereferenced null pointer).Nick Lewycky2016-05-141-0/+15
| | | | llvm-svn: 269572
* When typo-correcting a using-declaration, actually correct the name of theRichard Smith2016-05-141-0/+4
| | | | | | UsingDecl (so that redeclaration lookup can find it). llvm-svn: 269530
* Use marginally more appropriate functions to detect if we should declare anRichard Smith2016-05-132-5/+6
| | | | | | | implicit copy constructor/assignment, and other minor cleanups. No functionality change intended. llvm-svn: 269457
* Revert "[OpenCL] Add supported OpenCL extensions to target info."Yaxun Liu2016-05-131-7/+1
| | | | | | | | | Revert r269431 due to build failure caused by warning msg: llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 'setSupportedOpenCLOpts' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] void setSupportedOpenCLOpts() { llvm-svn: 269435
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-131-1/+7
| | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269431
* Prune four superfluous ExternalSemaSource.h includes and one forward ↵Yaron Keren2016-05-133-3/+0
| | | | | | | | declaration in Sema.h where ExternalSemaSource.h was already included due to ExternalSemaSource:: member uses. llvm-svn: 269423
* [ms][dll] #27212: Generating of implicit special members should take into ↵Dmitry Polukhin2016-05-131-4/+6
| | | | | | | | | | | | | | account MSVC compatibility version Clang creates implicit move constructor/assign operator in all cases if there is std=c++11. But MSVC supports such generation starting from version 1900 only. As result we have some binary incompatibility. Differential Revision: http://reviews.llvm.org/D19156 Patch by Andrew V. Tischenko llvm-svn: 269400
* Add support for derived class special members hiding functions brought in fromRichard Smith2016-05-131-35/+72
| | | | | | | | | a base class via a using-declaration. If a class has a using-declaration declaring either a constructor or an assignment operator, eagerly declare its special members in case they need to displace a shadow declaration from a using-declaration. llvm-svn: 269398
* Preserve the FoundDecl properly in constructor overload resolution. NoRichard Smith2016-05-121-9/+5
| | | | | | functionality change; this information is not yet in use. llvm-svn: 269382
* Preserve the FoundDecl when performing overload resolution for constructors.Richard Smith2016-05-118-174/+157
| | | | | | | | | This is in preparation for C++ P0136R1, which switches the model for inheriting constructors over from synthesizing a constructor to finding base class constructors (via using shadow decls) when looking for derived class constructors. llvm-svn: 269231
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-117-19/+59
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367 and PR27666. Differential Revision: http://reviews.llvm.org/D20103 llvm-svn: 269220
* Relax -Wcalling-convention-cast when casting to the default convention (cdecl)Reid Kleckner2016-05-111-1/+9
| | | | llvm-svn: 269214
* [Sema] Fix value-dependent enable_if bug.George Burgess IV2016-05-111-13/+6
| | | | | | | | | | | | | | | This patch fixes a bug where we would assume all value-dependent enable_if conditions give successful results. Instead, we consider value-dependent enable_if conditions to always fail. While this isn't ideal, this is the best we can realistically do without changing both enable_if's semantics and large parts of Sema (specifically, all of the parts that don't expect type dependence to come out of nowhere, and that may interact with overload resolution). Differential Revision: http://reviews.llvm.org/D20130 llvm-svn: 269154
* Add -Wcast-calling-convention to warn when casting away calling conventionsReid Kleckner2016-05-101-1/+88
| | | | | | | | | | | | | | | | | | | | | | Summary: This only warns on casts of the address of a function defined in the current TU. In this case, the fix is likely to be local and the warning useful. Here are some things we could experiment with in the future: - Fire on declarations as well as definitions - Limit the warning to non-void function prototypes - Limit the warning to mismatches of caller and callee cleanup CCs This warning is currently off by default while we study its usefulness. Reviewers: thakis, rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17348 llvm-svn: 269116
* [Sema] Fix an overload resolution bug with enable_if.George Burgess IV2016-05-101-21/+37
| | | | | | | | | | | | | | | | | | | | | | Currently, if clang::isBetterOverloadCandidate encounters an enable_if attribute on either candidate that it's inspecting, it will ignore all lower priority attributes (e.g. pass_object_size). This is problematic in cases like: ``` void foo(char *c) __attribute__((enable_if(1, ""))); void foo(char *c __attribute__((pass_object_size(0)))) __attribute__((enable_if(1, ""))); ``` ...Because we would ignore the pass_object_size attribute in the second `foo`, and consider any call to `foo` to be ambiguous. This patch makes overload resolution consult further tiebreakers (e.g. pass_object_size) if two candidates have equally good enable_if attributes. llvm-svn: 269005
* [CUDA] Restrict init of local __shared__ variables to empty constructors only.Artem Belevich2016-05-091-4/+5
| | | | | | | | | | Allow only empty constructors for local __shared__ variables in a way identical to restrictions imposed on dynamic initializers for global variables on device. Differential Revision: http://reviews.llvm.org/D20039 llvm-svn: 268982
* [CUDA] Only __shared__ variables can be static local on device side.Artem Belevich2016-05-091-1/+10
| | | | | | | | | | According to CUDA programming guide (v7.5): > E.2.9.4: Within the body of a device or global function, only > shared variables may be declared with static storage class. Differential Revision: http://reviews.llvm.org/D20034 llvm-svn: 268962
* [OpenMP] Parse+Sema for '#pragma omp declare target' syntax version 4.5Dmitry Polukhin2016-05-091-10/+83
| | | | | | | | | | | | | | | | | Support OpenMP version 4.5 syntax for #pragma omp declare target. Syntax: #pragma omp declare target (extended-list) new-line or #pragma omp declare target clause[ [,] clause ... ] new-line Where clause is one of the following: to(extended-list) link(list) Differential Revision: http://reviews.llvm.org/D20011 llvm-svn: 268925
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-098-25/+107
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* Fix spurious warnings about unused private fieldOlivier Goffart2016-05-091-4/+6
| | | | | | | | | | | | If the address of a field is taken as a pointer to member, we should not warn that the field is not used. Normaly, yse of fields are done from MemberExpr, but in case of pointer to member, it is in a DeclRefExpr Differential Revision: http://reviews.llvm.org/D20054 llvm-svn: 268895
* Availability: set location when creating attribute for tvos, watchos.Manman Ren2016-05-062-6/+13
| | | | | | | | | | | | When inferring availability attributes for tvos, watchos from ios, we use the same source location and set the implicit bit to true. So when emitting diagnostics on inferred attributes, we have a source location. rdar://25893544 llvm-svn: 268793
* Availability: attach the note to the declaration with the attributes.Manman Ren2016-05-061-3/+50
| | | | | | | | | | | | | Sometimes, the declaration we found has inherited availability attributes, attaching the note to it does not tell us where the availability attributes are in the source. Go through the redecl chain to find the declaration with actual availability attributes. rdar://25221771 llvm-svn: 268786
* Revert r268727, it caused PR27666.Nico Weber2016-05-067-39/+15
| | | | llvm-svn: 268736
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-067-15/+39
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367. Differential Revision: http://reviews.llvm.org/D19654 llvm-svn: 268727
* Add a FixItHint for the new diagnostic for a non-class-scope ↵Richard Smith2016-05-051-0/+14
| | | | | | using-declaration that names a class-scope enumerator. llvm-svn: 268664
* Update FIXME.Richard Smith2016-05-051-2/+1
| | | | llvm-svn: 268595
* Fix implementation of C++'s restrictions on using-declarations referring to ↵Richard Smith2016-05-051-5/+17
| | | | | | | | | | | enumerators: * an unscoped enumerator whose enumeration is a class member is itself a class member, so can only be the subject of a class-scope using-declaration. * a scoped enumerator cannot be the subject of a class-scope using-declaration. llvm-svn: 268594
* [modules] Enforce the rules that an explicit or partial specialization must beRichard Smith2016-05-057-59/+335
| | | | | | | | declared before it is used. Because we don't use normal name lookup to find these, the normal code to filter out non-visible names from name lookup results does not apply. llvm-svn: 268585
* Add the Pure attribute to C99 builtin functions from ctype.h. This is a ↵Aaron Ballman2016-05-041-271/+273
| | | | | | | | corrected version of r266199 with test case fixes. Patch by Taewook Oh. llvm-svn: 268553
* [ObjC] Enter a new evaluation context before callingAkira Hatanaka2016-05-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BuildBlockForLambdaConversion. Previously, clang would build an incorrect AST for the following code: id test() { return @{@"a": [](){}, @"b": [](){}}; } ReturnStmt 0x10d080448 `-ExprWithCleanups 0x10d080428 |-cleanup Block 0x10d0801f0 // points to the second BlockDecl ... -BlockDecl 0x10d07f150 // First block ... -BlockDecl 0x10d0801f0 // Second block ... `-ExprWithCleanups 0x10d0801d0 |-cleanup Block 0x10d07f150 // points to the first BlockDecl To fix the bug, this commit enters a new evaluation context to reset ExprNeedsCleanups before each block is parsed. rdar://problem/16879958 Differential Revision: http://reviews.llvm.org/D18815 llvm-svn: 268527
* [NFC] Initialize a variable to make buildbot green.Denis Zobnin2016-04-291-1/+1
| | | | | | | | | In r268085 "[MS] Make #pragma pack use PragmaStack<> class." there was an uninitialized variable 'Alignment', which caused the following failure: http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/1758 Zero-initialize the variable to fix this failure. llvm-svn: 268129
* [Sema] Specify the underlying type for an enum. NFC.George Burgess IV2016-04-291-1/+1
| | | | llvm-svn: 268113
* Method Pool in modules: we make sure that if a module contains an entry forManman Ren2016-04-293-0/+12
| | | | | | | | | | | | | | | a selector, the entry should be complete, containing everything introduced by that module and all modules it imports. Before writing out the method pool of a module, we sync up the out of date selectors by pulling in methods for the selectors, from all modules it imports. In ReadMethodPool, after pulling in the method pool entry for module A, this lets us skip the modules that module A imports. rdar://problem/25900131 llvm-svn: 268091
* [MS] Make #pragma pack use PragmaStack<> class.Denis Zobnin2016-04-292-156/+41
| | | | | | | | | | | | | | | Make implementation of #pragma pack consistent with other "stack" pragmas. Use PragmaStack<> class instead of old representation of internal stack. Don't change compiler's behavior. TODO: 1. Introduce diagnostics on popping named slots from pragma stacks. Reviewer: rnk Differential revision: http://reviews.llvm.org/D19727 llvm-svn: 268085
* Fix crash in BuildCXXDefaultInitExpr.Reid Kleckner2016-04-291-2/+13
| | | | | | | | | | | Fix crash in BuildCXXDefaultInitExpr when member of template class has same name as the class itself. Based on patch by Raphael "Teemperor" Isemann! Differential Revision: http://reviews.llvm.org/D19721 llvm-svn: 268082
* [Concepts] Pass requires-clause to ActOnTemplateParameterList; NFCHubert Tong2016-04-291-3/+6
| | | | | | | | | | | | | | Summary: Prepare to store requires-clause expression for access via TemplateParameterList. Reviewers: aaron.ballman, faisalv, rsmith Subscribers: cfe-commits, nwilson Differential Revision: http://reviews.llvm.org/D19220 llvm-svn: 268081
* Add a Subjects line to NoDebugAttr [NFC].Paul Robinson2016-04-291-12/+0
| | | | | | | | | | | The 'nodebug' attribute had hand-coded constraints; replace those with a Subjects line in Attr.td. Also add a missing test to verify the attribute is okay on an Objective-C method. Differential Revision: http://reviews.llvm.org/D19689 llvm-svn: 268065
* Recommit "[MS] Improved implementation of stack pragmas (vtordisp, *_seg)"Denis Zobnin2016-04-292-25/+31
| | | | | | | | | | | | | | | | | | | | | | Slightly updated version, double-checked build and tests. Improve implementation of MS pragmas that use stack + compatibility fixes. This patch: 1. Changes implementation of #pragma vtordisp to use PragmaStack class that other stack pragmas use; 2. Fixes "#pragma vtordisp()" behavior - it shouldn't affect the stack; 3. Supports "save-restore" of pragma stacks on enter / exit a C++ method body, as MSVC does. TODO: 1. Change implementation of #pragma pack to use the same approach; 2. Introduce diagnostics on popping named stack slots, as MSVC does. Reviewers: rnk, thakis Differential revision: http://reviews.llvm.org/D19361 llvm-svn: 268029
OpenPOWER on IntegriCloud