summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Replace MarkVarRequired with a more genericRafael Espindola2012-03-081-4/+3
| | | | | | HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. llvm-svn: 152320
* Add support for cooked forms of user-defined-integer-literal andRichard Smith2012-03-081-28/+67
| | | | | | | user-defined-floating-literal. Support for raw forms of these literals to follow. llvm-svn: 152302
* Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix notRichard Smith2012-03-081-21/+6
| | | | | | | | | | | | | | | | | | starting with an underscore is ill-formed. Since this rule rejects programs that were using <inttypes.h>'s macros, recover from this error by treating the ud-suffix as a separate preprocessing-token, with a DefaultError ExtWarn. The approach of treating such cases as two tokens is under discussion for standardization, but is in any case a conforming extension and allows existing codebases to keep building while the committee makes up its mind. Reword the warning on the definition of literal operators not starting with underscores (which are, strangely, legal) to more explicitly state that such operators can't be called by literals. Remove the special-case diagnostic for hexfloats, since it was both triggering in the wrong cases and incorrect. llvm-svn: 152287
* Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUGDaniel Dunbar2012-03-081-1/+3
| | | | | | builds. Sheesh. llvm-svn: 152279
* User-defined literal support for character literals.Richard Smith2012-03-081-4/+27
| | | | llvm-svn: 152277
* Fix -Wuninitialized to catch the case of a class being initialized with a callRichard Trieu2012-03-081-1/+2
| | | | | | to its own member function. llvm-svn: 152276
* improve on diagnostic and provide a fixit hint whenFariborz Jahanian2012-03-081-7/+19
| | | | | | | an uninitialized block variable is being called inside the block literal. // rdar://10817031 llvm-svn: 152271
* Be smarter in discovering list-initialization of temporaries. Fixes PR12182.Sebastian Redl2012-03-071-1/+1
| | | | llvm-svn: 152231
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-073-4/+130
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* objective-c lldb support: don't perform ivar access control check Fariborz Jahanian2012-03-072-10/+12
| | | | | | when debugging. // rdar://10997647 llvm-svn: 152187
* Refactor Clang sema attribute handling.Michael Han2012-03-073-130/+21
| | | | | | | | | | | | | | | | | This submission improves Clang sema handling by using Clang tablegen to generate common boilerplate code. As a start, it implements AttributeList enumerator generation and case statements for AttributeList::getKind. A new field "SemaHandler" is introduced in Attr.td and by default set to 1 as most of attributes in Attr.td have semantic checking in Sema. For a small number of attributes that don't appear in Sema, the value is set to 0. Also there are a small number of attributes that only appear in Sema but not in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList. Reviewed by Delesley Hutchins. llvm-svn: 152169
* Cleanup (style). Thanks to Argyrios for catchingSean Callanan2012-03-061-8/+3
| | | | | | this. llvm-svn: 152158
* CMake: Fix build to add clangEdit to USED_LIBS.NAKAMURA Takumi2012-03-061-1/+7
| | | | llvm-svn: 152154
* Extended the UnknownAnyTy resolver to handleSean Callanan2012-03-061-10/+34
| | | | | | | | blocks with unknown return types. This allows LLDB to call blocks even when their return types aren't provided in the debug information. llvm-svn: 152147
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-0610-24/+1470
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* Undo patch for // rdar://10735698Fariborz Jahanian2012-03-061-6/+1
| | | | llvm-svn: 152128
* static_assert: Allow any string-literal as the message, not just a characterRichard Smith2012-03-051-2/+6
| | | | | | | string literal, and adjust the diagnostic code to match. This also causes us to escape any control characters in the message. llvm-svn: 152069
* If the element type of an initializer list has a destructor, make sure we ↵Sebastian Redl2012-03-052-2/+14
| | | | | | check it. Fixes PR12178. llvm-svn: 152048
* patch to optionally warn for block implementations without explicit Fariborz Jahanian2012-03-051-1/+6
| | | | | | return types that return non-void values. // rdar://10735698 llvm-svn: 152047
* Avoid double lookup.Benjamin Kramer2012-03-051-3/+5
| | | | llvm-svn: 152033
* Fix a small difference in sema and codegen views of what needs to be output.Rafael Espindola2012-03-051-4/+8
| | | | | | | | | | | | In the included testcase, soma thinks that we already have a definition after we see the out of line decl. Codegen puts it in a deferred list, to be output if a use is seen. This would break when we saw an explicit template instantiation definition, since codegen would not be notified. This patch adds a method to the consumer interface so that soma can notify codegen that this decl is now required. llvm-svn: 152024
* Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.Richard Smith2012-03-041-5/+10
| | | | llvm-svn: 151997
* Add -Wstring-plus-int, which warns on "str" + int and int + "str".Nico Weber2012-03-021-3/+48
| | | | | | | | It doesn't warn if the integer is known at compile time and within the bounds of the string. Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203 llvm-svn: 151943
* objc: When issue diagnostic about deprecated method, alsoFariborz Jahanian2012-03-022-3/+12
| | | | | | | issue the note if it is because message is sent to a forward class declaration in delayed diagnostic. // rdar://10290322 llvm-svn: 151942
* [Sema] Fix crash-on-invalid-code issue:Argyrios Kyrtzidis2012-03-021-1/+1
| | | | | | | | | | @class I; @implementation I(cat) // crashes here @end rdar://10968158 llvm-svn: 151931
* Change diagnostic test for my last patch.Fariborz Jahanian2012-03-021-3/+2
| | | | | | // rdar://10961370 llvm-svn: 151923
* Ensure that we instantiate static reference data members of class templatesRichard Smith2012-03-021-2/+3
| | | | | | | | | early, since their values can be used in constant expressions in C++11. For odr-use checking, the opposite change is required, since references are odr-used whether or not they satisfy the requirements for appearing in a constant expression. llvm-svn: 151881
* c/objc: problem originally reported as an objective-c bug.Fariborz Jahanian2012-03-011-0/+6
| | | | | | | | | But it is in the underlying c part of clang. clang crashes in IRGen when passing an incomplete type argument to variadic function (instead of diagnosing the bug). // rdar://10961370 llvm-svn: 151862
* Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.Eli Friedman2012-03-012-0/+3
| | | | llvm-svn: 151837
* Implement "optimization" for lambda-to-block conversion which inlines the ↵Eli Friedman2012-03-013-79/+130
| | | | | | | | generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap. Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed. llvm-svn: 151797
* Fix regression from llvm-gcc where we should NOT emit a warning about ↵Ted Kremenek2012-03-011-1/+8
| | | | | | __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>. llvm-svn: 151786
* Tighten type-checking a bit to make it clearer how BuildCXXMemberCallExpr is ↵Eli Friedman2012-03-011-2/+3
| | | | | | used. llvm-svn: 151783
* objective-c: provide fixit hint when atomic property does notFariborz Jahanian2012-02-291-8/+39
| | | | | | | have matching user defined setter/getter and a warning is issued. In this case, a fixit note is displayed. // rdar://10267155 llvm-svn: 151766
* Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.Eli Friedman2012-02-291-1/+1
| | | | llvm-svn: 151754
* Tentatively fix PR12117. The test case from the bug now passes, and all ↵Sebastian Redl2012-02-291-8/+11
| | | | | | existing tests still pass, but there may still be corner cases. llvm-svn: 151716
* Reapply r151638 and r151641.James Molloy2012-02-294-3/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation. These are now fixed, with regression tests added to catch them both (not Darwin-specific). Original log: ==================== Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. ==================== llvm-svn: 151712
* A couple minor bug-fixes for template instantiation for expressions which ↵Eli Friedman2012-02-292-12/+15
| | | | | | are sometimes potentially evaluated. llvm-svn: 151707
* Make the odr-use logic work correctly for constant-expressions. PR12006.Eli Friedman2012-02-292-0/+19
| | | | llvm-svn: 151699
* Sema/ObjC: Override search can generate a large search list, bump the base sizeDaniel Dunbar2012-02-291-3/+4
| | | | | | | | of the SmallPtrSet way up to avoid commonly reallocating the buffer size. - I didn't see a good argument against it, so I bumped the limit to cover the max size we see during parsing Cocoa.h. llvm-svn: 151698
* Make sure list-initialization of arrays works correctly in explicit type ↵Eli Friedman2012-02-291-14/+18
| | | | | | conversions. PR12121. llvm-svn: 151674
* Revert r151638 because it causes assertion hit on PCH creation for Cocoa.hArgyrios Kyrtzidis2012-02-284-82/+3
| | | | | | | | | | | | | | | | | | | | Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. llvm-svn: 151667
* Single- and zero-element initializer lists to scalars are ↵Sebastian Redl2012-02-281-0/+1
| | | | | | list-initializations. Fixes PR12118. llvm-svn: 151666
* Un-break clang based on r151638 - What was meant to be a trivial variable ↵James Molloy2012-02-281-1/+1
| | | | | | name change went horribly wrong and I forgot to retest afterwards. llvm-svn: 151641
* Correctly track tags and enum members defined in the prototype of a ↵James Molloy2012-02-284-3/+82
| | | | | | | | | | | | | | | function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. llvm-svn: 151638
* [AST] When we @synthesize a property with a user-defined ivar name,Argyrios Kyrtzidis2012-02-281-5/+5
| | | | | | | | | | make sure to record the source location of the ivar name. [libclang] When indexing @synthesized objc methods, report the @implementation as the lexical container. Fixes rdar://10905472 llvm-svn: 151635
* [AST] Associate the getter/setter methods to a property of a objc class ↵Argyrios Kyrtzidis2012-02-281-4/+8
| | | | | | | | | | extension. [libclang] Index the getter/setter methods of a property of a objc class extension. Fixes rdar://10907597 llvm-svn: 151633
* After numerous requests, have Objective-C 'method declared here' notes ↵Ted Kremenek2012-02-272-8/+16
| | | | | | mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035. llvm-svn: 151579
* Implement a FIXME for conversion sequence distinction. Should fix PR12092.Sebastian Redl2012-02-271-2/+10
| | | | llvm-svn: 151577
* Fix a couple bugs in the way we handle array indexes in array bounds ↵Eli Friedman2012-02-271-4/+4
| | | | | | checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>. llvm-svn: 151569
* Convert initializer lists to temporaries in CreateBuiltinBinOp. Allows ↵Sebastian Redl2012-02-271-0/+19
| | | | | | assignment of init lists to built-in types and resolves PR12088. llvm-svn: 151551
OpenPOWER on IntegriCloud