summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-1/+2
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Fix a Sema invariant bug that I recently introduced involvingJohn McCall2012-04-061-0/+3
| | | | | | | | | the template instantiation of statement-expressions. I think it was jyasskin who had a crashing testcase in this area; hopefully this fixes it and he can find his testcase and check it in. llvm-svn: 154189
* Properly implement the C rules for composite types for qualified pointers in ↵Eli Friedman2012-04-051-11/+27
| | | | | | conditionals. Patch by Tim Northover. llvm-svn: 154134
* Enter an expression evaluation context when parsingJohn McCall2012-04-041-0/+14
| | | | | | | statement-expressions. Prevents cleanups and such from being claimed by the first full-expression in the block. llvm-svn: 153989
* Remove dead assignment to local variable.Ted Kremenek2012-04-041-2/+0
| | | | llvm-svn: 153985
* Finish PR10217: Ensure we say that a special member was implicitly, notRichard Smith2012-04-021-8/+11
| | | | | | explicitly, deleted in all relevant cases, and explain why. llvm-svn: 153894
* PR10217: Provide diagnostics explaining why an implicitly-deleted specialRichard Smith2012-03-301-1/+20
| | | | | | member function is deleted. llvm-svn: 153773
* Forbid the block and lambda copy-capture of __autoreleasing variablesJohn McCall2012-03-301-0/+21
| | | | | | in ARC, under the usual reasoning limiting the use of __autoreleasing. llvm-svn: 153725
* objective-c: Improve diagnostics andFariborz Jahanian2012-03-281-6/+6
| | | | | | | provide 'fixit' hint when dictionary index is not of proper type. // rdar://11062080 llvm-svn: 153584
* Alternate fix to PR12248: put Sema in charge of special-casingJohn McCall2012-03-131-3/+36
| | | | | | | | | the diagnostic for assigning to a copied block capture. This has the pleasant side-effect of letting us special-case the diagnostic for assigning to a copied lambda capture as well, without introducing a new non-modifiable enumerator for it. llvm-svn: 152593
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-107/+107
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-62/+12
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-11/+12
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-091-23/+117
| | | | | | and lots of tidying up. llvm-svn: 152392
* [AST] Reduce Decl::getASTContext() calls.Daniel Dunbar2012-03-091-4/+5
| | | | | | | - This function is not at all free; pass it around along some hot paths instead of recomputing it deep inside various VarDecl methods. llvm-svn: 152363
* Don't crash when a statement in a block is ill-formed butJohn McCall2012-03-081-0/+2
| | | | | | introduces cleanups anyway. llvm-svn: 152345
* 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
* User-defined literal support for character literals.Richard Smith2012-03-081-4/+27
| | | | llvm-svn: 152277
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-4/+21
| | | | | | | | | | | | | | | | | | | | | 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-071-1/+2
| | | | | | when debugging. // rdar://10997647 llvm-svn: 152187
* Cleanup (style). Thanks to Argyrios for catchingSean Callanan2012-03-061-8/+3
| | | | | | this. llvm-svn: 152158
* 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-061-4/+21
| | | | | | | | | | | | | 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
* 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
* 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
* 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-011-0/+1
| | | | llvm-svn: 151837
* Fix a couple -Wuninitialized warnings from gcc. Reported by David Greene.Eli Friedman2012-02-291-1/+1
| | | | llvm-svn: 151754
* A couple minor bug-fixes for template instantiation for expressions which ↵Eli Friedman2012-02-291-0/+2
| | | | | | are sometimes potentially evaluated. llvm-svn: 151707
* Make the odr-use logic work correctly for constant-expressions. PR12006.Eli Friedman2012-02-291-0/+12
| | | | llvm-svn: 151699
* 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
* Make sure we don't try to produce a definition of an implicitly-deleted functionRichard Smith2012-02-261-3/+5
| | | | llvm-svn: 151478
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-4/+5
| | | | llvm-svn: 151447
* Improve the diagnostic in ARC mode when a conditional with an Objective-C ↵Eli Friedman2012-02-251-0/+16
| | | | | | type and void* is used. <rdar://problem/10486347>. llvm-svn: 151416
* Implement C++11 [over.match.copy]p1b2, which allows the use ofDouglas Gregor2012-02-241-2/+5
| | | | | | | | | | | explicit conversion functions to initialize the argument to a copy/move constructor that itself is the subject of direct initialization. Since we don't have that much context in overload resolution, we end up threading more flags :(. Fixes <rdar://problem/10903741> / PR10456. llvm-svn: 151409
* Pull the OpaqueValueExpr's source expression into its constructor, soDouglas Gregor2012-02-231-1/+2
| | | | | | that we can correctly compute value-dependence of the OVE. llvm-svn: 151291
* Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is aRichard Smith2012-02-221-2/+11
| | | | | | | | | | | | | | | | | | function call (or a comma expression with a function call on its right-hand side), possibly parenthesized, then the return type is not required to be complete and a temporary is not bound. Other subexpressions inside a decltype expression do not get this treatment. This is implemented by deferring the relevant checks for all calls immediately within a decltype expression, then, when the expression is fully-parsed, checking the relevant constraints and stripping off any top-level temporary binding. Deferring the completion of the return type exposed a bug in overload resolution where completion of the argument types was not attempted, which is also fixed by this change. llvm-svn: 151117
* Improve our handling of lambda expressions that occur within defaultDouglas Gregor2012-02-211-4/+22
| | | | | | | | | | | | | | | | | | | arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. llvm-svn: 151076
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-211-2/+4
| | | | | | | | | | | | | | | | default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. llvm-svn: 151011
* Fix wrong-code bug: __imag on a scalar lvalue should produce a zero rvalue,Richard Smith2012-02-181-4/+10
| | | | | | rather than an lvalue referring to the scalar. llvm-svn: 150889
* Remove unused but set variable.Benjamin Kramer2012-02-181-3/+0
| | | | llvm-svn: 150877
* Rewrite variable capture within lambda expressions and blocks,Douglas Gregor2012-02-181-196/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eliminating a bunch of redundant code and properly modeling how the captures of outside blocks/lambdas affect the types seen by inner captures. This new scheme makes two passes over the capturing scope stack. The first pass goes up the stack (from innermost to outermost), assessing whether the capture looks feasible and stopping when it either hits the scope where the variable is declared or when it finds an existing capture. The second pass then walks down the stack (from outermost to innermost), capturing the variable at each step and updating the captured type and the type that an expression referring to that captured variable would see. It also checks type-specific restrictions, such as the inability to capture an array within a block. Note that only the first odr-use of each variable needs to do the full walk; subsequent uses will find the capture immediately, so multiple walks need not occur. The same routine that builds the captures can also compute the type of the captures without signaling errors and without actually performing the capture. This functionality is used to determine the type of declaration references as well as implementing the weird decltype((x)) rule within lambda expressions. The capture code now explicitly takes sides in the debate over C++ core issue 1249, which concerns the type of captures within nested lambdas. We opt to use the more permissive, more useful definition implemented by GCC rather than the one implemented by EDG. llvm-svn: 150875
* Unify our computation of the type of a captured reference to aDouglas Gregor2012-02-181-41/+40
| | | | | | | variable; it was previously duplicated, and one of the copies failed to account for outer non-mutable lambda captures. llvm-svn: 150872
* Only add 'const' to the type of variables captured in a lambda whenDouglas Gregor2012-02-171-2/+7
| | | | | | we're capturing it by value in a non-mutable lambda. llvm-svn: 150791
* Lambda closure types are always considered to be like "local" classes,Douglas Gregor2012-02-161-0/+1
| | | | | | | | | even if they are not within a function scope. Teach template instantiation to treat them as such, and make sure that we have a local instantiation scope when instantiating default arguments and static data members. llvm-svn: 150725
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-161-3/+1
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
* Revert "Make CXXNewExpr contain only a single initialier, and not hold the ↵Sebastian Redl2012-02-161-1/+3
| | | | | | | | | | used constructor itself." It leads to a compiler crash in the Bullet benchmark. This reverts commit r12014. llvm-svn: 150684
OpenPOWER on IntegriCloud