summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* getMostSpecialized for function template sets is never used in the context of aRichard Smith2013-09-103-6/+5
| | | | | | | call; remove its 'number of explicit arguments' and 'what kind of call' parameters. llvm-svn: 190444
* Ignore noreturn when checking function template specializationsReid Kleckner2013-09-101-2/+5
| | | | | | | | | | As requested when applying the same logic to calling conventions. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1634 llvm-svn: 190441
* PR5683: Issue a warning when subtracting pointers to types of zero size, andRichard Smith2013-09-101-0/+12
| | | | | | | treat such subtractions as being non-constant. Patch by Serge Pavlov! With a few tweaks by me. llvm-svn: 190439
* Fix regression from r190382.Eli Friedman2013-09-102-8/+9
| | | | | | | | | Make sure we perform the correct "referenced-but-not-used" check for static member constants. Fixes bug reported on cfe-commits by Alexey Samsonov. llvm-svn: 190437
* [ms-cxxabi] Implement guard variables for static initializationReid Kleckner2013-09-102-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Static locals requiring initialization are not thread safe on Windows. Unfortunately, it's possible to create static locals that are actually externally visible with inline functions and templates. As a result, we have to implement an initialization guard scheme that is compatible with TUs built by MSVC, which makes thread safety prohibitively difficult. MSVC's scheme is that every function that requires a guard gets an i32 bitfield. Each static local is assigned a bit that indicates if it has been initialized, up to 32 bits, at which point a new bitfield is created. MSVC rejects inline functions with more than 32 static locals, and the externally visible mangling (?_B) only allows for one guard variable per function. On Eli's recommendation, I used MangleNumberingContext to track which bit each static corresponds to. Implements PR16888. Reviewers: rjmccall, eli.friedman Differential Revision: http://llvm-reviews.chandlerc.com/D1416 llvm-svn: 190427
* Rejected 190391, due to failures on ↵Stepan Dyatkovskiy2013-09-101-12/+65
| | | | | | clang-x86_64-darwin11-nobootstrap-RAincremental. llvm-svn: 190393
* Fix for PR16752. Second commit.Stepan Dyatkovskiy2013-09-101-65/+12
| | | | | | | | | | | | | | | | | | | | | PR16752: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth methods. Methods asks target for proper type for given bit width. 2. Fix handleModeAttr according to new methods in TargetInfo. Fixes: 1st Commit (Done): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Current): Fix SemaDeclAttr, handleModeAttr function. llvm-svn: 190391
* Make -Wunused warning rules more consistent.Eli Friedman2013-09-102-21/+27
| | | | | | | | | | | | | | | This patch does a few different things. This patch improves unused var diags for const vars: we no longer unconditionally suppress diagnostics for const vars, instead only suppressing the diagnostic when the declaration appears to be useful. This patch also makes us more consistently use whether a variable/function is declared in the main file to suppress diagnostics where appropriate. Fixes <rdar://problem/14907887>. llvm-svn: 190382
* Ignore calling conventions when checking function template specializationsReid Kleckner2013-09-101-3/+13
| | | | | | | | | | | | | | | | | | | | Summary: Calling conventions are inherited during decl merging. Before this change, deduction would fail due to a type mismatch between the template and the specialization. This change adjusts the CCs to match before deduction, and lets the decl merging logic diagnose mismatch or inherit the CC from the template. This allows specializations of static member function templates in the Microsoft C++ ABI. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1570 llvm-svn: 190377
* Adding a FIXME based on feedback from Richard Smith.Aaron Ballman2013-09-091-0/+3
| | | | llvm-svn: 190369
* Attribute tablegen now understands that attribute arguments can be optional. ↵Aaron Ballman2013-09-093-228/+52
| | | | | | This allows for automated checking of the number of arguments expected vs number of arguments given for attributes. Greatly reduces the amount of manual checking required. llvm-svn: 190368
* C++ modules: if a class is defined in multiple modules (for instance, becauseRichard Smith2013-09-091-1/+1
| | | | | | | | | | | | it is an implicit instantiation of a class template specialization), pick the first-loaded definition to be the canonical definition, and merge all other definitions into it. This is still rather incomplete -- we need to extend every form of declaration that can appear within a CXXRecordDecl to be redeclarable if it came from an AST file (this includes fields, enumerators, ...). llvm-svn: 190315
* Sema: Don't crash on visibility attributes with an identifier argument.Benjamin Kramer2013-09-091-3/+4
| | | | | | PR17105. llvm-svn: 190312
* Fix constructor-related typos.Benjamin Kramer2013-09-093-3/+3
| | | | | | Noticed by Roman Divacky. llvm-svn: 190311
* Silencing an MSVC warning about an empty control statement (it dislikes ; ↵Aaron Ballman2013-09-091-2/+2
| | | | | | but is fine with {}). llvm-svn: 190305
* Removing the endian attribute and updating associated test cases. This ↵Aaron Ballman2013-09-091-22/+0
| | | | | | functionality was never completely implemented, and this is an improvement over silently eating the attribute. llvm-svn: 190303
* C++ modules: fix a bug where loading a declaration with some name would preventRichard Smith2013-09-091-0/+8
| | | | | | | | | | | | | | | | | name lookup from lazily deserializing the other declarations with the same name, by tracking a bit to indicate whether a name in a DeclContext might have additional external results. This also allows lazier reconciling of the lookup table if a module import adds decls to a pre-existing DC. However, this exposes a pre-existing bug, which causes a regression in test/Modules/decldef.mm: if we have a reference to a declaration, and a later-imported module adds a redeclaration, nothing causes us to load that redeclaration when we use or emit the reference (which can manifest as a reference to an undefined inline function, a use of an incomplete type, and so on). decldef.mm has been extended with an additional testcase which fails with or without this change. llvm-svn: 190293
* Fixed bug in call to CXXTemporaryObjectExpr ctor.Enea Zaffanella2013-09-071-1/+1
| | | | llvm-svn: 190249
* AST: __uuidof should leak through templated typesDavid Majnemer2013-09-071-7/+17
| | | | | | | | | | | | | | | Summary: __uuidof on templated types should exmaine if any of its template parameters have a uuid declspec. If exactly one does, then take it. Otherwise, issue an appropriate error. Reviewers: rsmith, thakis, rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1419 llvm-svn: 190240
* Fix missing source location in CXXTemporaryObjectExpr nodes.Enea Zaffanella2013-09-073-10/+18
| | | | | | | | For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange in CXXConstructExpr nodes. Added testcase. llvm-svn: 190239
* Remove error-prone 'list initialization' flag from an implicit conversionRichard Smith2013-09-061-22/+10
| | | | | | | sequence. All that matters here is whether we're doing the std::initializer_list special case thing. llvm-svn: 190213
* Preserve exception specs in function decl merging.Eli Friedman2013-09-061-2/+4
| | | | | | | | | Exception specs are not part of the canonical type, but we shouldn't drop them just because we merged a noreturn attribute. Fixes PR17110. llvm-svn: 190206
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-063-13/+558
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
* OpenCL allows the (pre/post)-(increment/decrement) operator on integer ↵David Tweed2013-09-061-0/+3
| | | | | | | | | | vector types, so allow that case and add appropriate tests. Patch by Ruiling Song! llvm-svn: 190129
* Add self-comparison warnings for fields.Eli Friedman2013-09-061-30/+43
| | | | | | | | | | | | This expands very slightly what -Wtautological-compare considers to be tautological to include implicit accesses to C++ fields and ObjC ivars. I don't want to turn this into a full expression-identity check, but these additions seem pretty well-contained, and maintain the theme of checking for "x == x". <rdar://problem/14431127> llvm-svn: 190118
* Consumed Analysis: The 'consumable' attribute now takes a identifier ↵David Blaikie2013-09-061-2/+25
| | | | | | | | | | | | | specifying the default assumed state for objects of this class This information is used for return states and pass-by-value parameter states. Patch by Chris Wailes. Review by DeLesley Hutchins and Aaron Ballman. llvm-svn: 190116
* When creating an implicit conversion sequence for a reference of type T from anRichard Smith2013-09-061-5/+12
| | | | | | | | initializer list containing a single element of type T, be sure to mark the sequence as a list conversion sequence so that it is known to be worse than an implicit conversion sequence that initializes a std::initializer_list object. llvm-svn: 190115
* Reduce stack usage of TreeTransform.Eli Friedman2013-09-061-0/+5
| | | | | | | | | | | | | | | Without this patch, TreeTransform::TransformExpr uses a ridiculous amount of stack space (around 5000 bytes). Preventing inlining brings the stack usage down to something sane. On a testcase I have, on my computer, this allows changing -ftemplate-depth from 210 to around 750 before we crash. I'm not sure I should commit the testcase, though: I don't want to cause test failures on platforms with less stack space available. <rdar://problem/14098189>. llvm-svn: 190114
* Improve error for "override" + non-virtual func.Eli Friedman2013-09-051-34/+77
| | | | | | | | | | | | | | | | | | | Consider something like the following: struct X { virtual void foo(float x); }; struct Y : X { void foo(double x) override; }; The error is almost certainly that Y::foo() has the wrong signature, rather than incorrect usage of the override keyword. This patch adds an appropriate diagnostic for that case. Fixes <rdar://problem/14785106>. llvm-svn: 190109
* Note when a decl is used in AST files.Eli Friedman2013-09-056-24/+22
| | | | | | | | | | | | | | | When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. llvm-svn: 190016
* Clear LookupResult object if invalid candidate is found.Serge Pavlov2013-09-041-3/+9
| | | | | | | If source code is invalid, error recovery can lead to name lookup in a set containing invalid declaration. The lookup is stopped once found such declaration, but LookupResult object could remain in inconsistent state. Its destructor triggered a check, which caused assert violation. This patch fixes PR16964 and PR12791. llvm-svn: 189916
* Reference extension is weird/surprising and unnecessary, let's not do that.David Blaikie2013-09-031-1/+1
| | | | | | Found by Chris Wailes llvm-svn: 189859
* Simplify. This function bails out a few lines above if !Found.empty().Richard Smith2013-09-031-1/+1
| | | | llvm-svn: 189857
* Switched FormatAttr to using an IdentifierArgument instead of a ↵Aaron Ballman2013-09-033-10/+16
| | | | | | StringArgument since that is a more accurate modeling. llvm-svn: 189851
* Refactor computation of whether a variable declaration's type should be mergedRichard Smith2013-09-031-39/+35
| | | | | | with a prior declaration. No functionality change intended. llvm-svn: 189850
* Consumed analysis: add return_typestate attribute.DeLesley Hutchins2013-09-032-31/+78
| | | | | | | | | | Patch by chris.wailes@gmail.com Functions can now declare what state the consumable type the are returning will be in. This is then used on the caller side and checked on the callee side. Constructors now use this attribute instead of the 'consumes' attribute. llvm-svn: 189843
* Factor out parsing and allocation of IdentifierLoc objects.Richard Smith2013-09-031-0/+8
| | | | llvm-svn: 189833
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-033-558/+13
| | | | | | | | This reverts commit r189795. threadprivate_messages.cpp is faling on windows. llvm-svn: 189811
* OpenMP: Data-sharing attributes analysis and clause 'shared'Alexey Bataev2013-09-033-13/+558
| | | | llvm-svn: 189795
* the call to UsualArithmeticConversions should come after the call to ↵Jin-Gu Kang2013-09-021-8/+9
| | | | | | CheckVectorOperands on CheckConditionalOperands function. This problem caused compilation error with test17 on "test/CodeGen/ext-vector.c". llvm-svn: 189773
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-314-232/+213
| | | | | | argument list. llvm-svn: 189711
* Consumed analysis: add 'consumable' class attribute.DeLesley Hutchins2013-08-301-15/+60
| | | | | | | | | | | | Patch by chris.wailes@gmail.com Adds the 'consumable' attribute that can be attached to classes. This replaces the previous method of scanning a class's methods to see if any of them have consumed analysis attributes attached to them. If consumed analysis attributes are attached to methods of a class that isn't marked 'consumable' a warning is generated. llvm-svn: 189702
* Sema: avoid reuse of Exprs when synthesizing operator=Pavel Labath2013-08-301-94/+197
| | | | | | | | | | | | | | | | | | Summary: Previously, Sema was reusing parts of the AST when synthesizing an assignment operator, turning it into a AS-dag. This caused problems for the static analyzer, which assumed an expression appears in the tree only once. Here I make sure to always create a fresh Expr, when inserting something into the AST, fixing PR16745 in the process. Reviewers: doug.gregor CC: cfe-commits, jordan_rose Differential Revision: http://llvm-reviews.chandlerc.com/D1425 llvm-svn: 189659
* Add ms_abi and sysv_abi attribute handling.Charles Davis2013-08-302-1/+31
| | | | | | Based on a patch by Benno Rice! llvm-svn: 189644
* Adjust clang for change to APFloat::toString.Eli Friedman2013-08-291-1/+9
| | | | | | | | I changed the diagnostic printing code because it's probably better to cut off a digit from DBL_MAX than to print something like 1.300000001 when the user wrote 1.3. llvm-svn: 189625
* Removed useless default branch of switch statement.Serge Pavlov2013-08-291-3/+0
| | | | | | The problem was caught by sanitizer build. llvm-svn: 189575
* Change return type of Sema::DiagnoseAmbiguousLookup from bool to void.Serge Pavlov2013-08-291-13/+8
| | | | | | The function always returned true value, which was never used. llvm-svn: 189571
* Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don'tRichard Smith2013-08-292-54/+22
| | | | | | do anything useful. llvm-svn: 189548
* Sema: Subst type default template args earlierDavid Majnemer2013-08-282-36/+68
| | | | | | | | | | | | | | | | | Summary: We would not perform substitution at an appropriate point, allowing strange results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like template-template parameters or non-type template parameters. Reviewers: doug.gregor, rjmccall, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1507 llvm-svn: 189540
* Mode is now handled as a non-inheritable attribute, and CUDADevice & ↵Aaron Ballman2013-08-281-5/+4
| | | | | | CUDAHost are now handled as inheritable attributes. In all three cases, this makes the processing behavior more consistent with the declared behavior in Attr.td. llvm-svn: 189532
OpenPOWER on IntegriCloud