summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-3/+3
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* C++11 weakens the requirement for types used with offsetof from POD to ↵Benjamin Kramer2012-04-281-2/+10
| | | | | | standard layout type. llvm-svn: 155757
* Rename isPODType (using the C++98 rules) into isCXX98PODType and make ↵Benjamin Kramer2012-04-281-1/+2
| | | | | | | | | | isPODType decide which one to use based on LangOptions. - -Wc++98-compat depends on the c++98 definition - Now __is_pod returns the right thing in c++11 and c++98 mode - All changes to the type traits test are validated against g++ 4.7 llvm-svn: 155756
* PR 12586: Fix assert while running libc++ testsuite: deal with exceptionRichard Smith2012-04-191-3/+2
| | | | | | | | | specifications on member function templates of class templates and other such nested beasties. Store the function template from which we are to instantiate an exception specification rather than trying to deduce it. Plus some additional test cases. llvm-svn: 155076
* VerifyICE: Pass PartialDiagnostics by reference.Benjamin Kramer2012-04-181-4/+5
| | | | llvm-svn: 155005
* Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.Richard Smith2012-04-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a new flavor of exception specification, EST_Uninstantiated. A function type with this exception specification carries a pointer to a FunctionDecl, and the exception specification for that FunctionDecl is instantiated (if needed) and used in the place of the function type's exception specification. When a function template declaration with a non-trivial exception specification is instantiated, the specialization's exception specification is set to this new 'uninstantiated' kind rather than being instantiated immediately. Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs on-demand. Also, any odr-use of a function triggers the instantiation of its exception specification (the exception specification could be needed by IRGen). In passing, fix two places where a DeclRefExpr was created but the corresponding function was not actually marked odr-used. We used to get away with this, but don't any more. Also fix a bug where instantiating an exception specification which refers to function parameters resulted in a crash. We still have the same bug in default arguments, which I'll be looking into next. This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to parse (and, in very limited testing, support) all of libstdc++4.7's standard headers. llvm-svn: 154886
* objective-c modern translator: buildit objc boolFariborz Jahanian2012-04-161-17/+1
| | | | | | | type for rewriter project will be BoolTy. // rdar://11231426. llvm-svn: 154861
* When we're flagging a protected scope to prevent jumps into theJohn McCall2012-04-131-10/+14
| | | | | | | | shadow of a block expression with non-trivial destructed cleanups, we should flag that in the enclosing function, not in the block that we're about to pop. llvm-svn: 154646
* objective-c literals: Issue warning and ignoreFariborz Jahanian2012-04-121-3/+7
| | | | | | | when BOOL is not of an intergal type when boolean literals are used. // rdar://11231426 llvm-svn: 154619
* Compute standard conversion sequences for conversions to atomicDouglas Gregor2012-04-121-4/+9
| | | | | | | | | | | | types. The second and third conversions in the sequence are based on the conversion for the underlying type, so that we get sensible overloading behavior for, e.g., _Atomic(int) vs. _Atomic(float). As part of this, actually implement the lvalue-to-rvalue conversion for atomic types. There is probably a pile of code in SemaExpr that can now be deleted, but I haven't tracked it down yet. llvm-svn: 154596
* objective-c numeric literal: type of boolean isFariborz Jahanian2012-04-121-1/+13
| | | | | | | that of typedef BOOL if found. // rdar://11231426 llvm-svn: 154595
* objective-c: remove IsConstProperty as it does notFariborz Jahanian2012-04-101-17/+1
| | | | | | | seem to get called any more. Also add an assert in isModifiableLvalue. llvm-svn: 154410
* objective-c: add an assertion for propertyFariborz Jahanian2012-04-101-0/+5
| | | | | | expression enterring IsConstProperty function. llvm-svn: 154406
* Fix bugs found by -Wconstant-conversion improvements currently under review.David Blaikie2012-04-091-1/+1
| | | | | | | | | | | | | | | | | | Specifically, using a an integer outside [0, 1] as a boolean constant seems to be an easy mistake to make with things like "x == a || b" where the author intended "x == a || x == b". The bug caused by calling SkipUntil with three token kinds was also identified by a VC diagnostic & reported by Francois Pichet as review feedback for my commit r154163. I've included test cases to verify the error recovery that was broken/poorly implemented due to this bug. The other fix (lib/Sema/SemaExpr.cpp) seems like that code was never actually reached in any of Clang's tests & is related to Objective C features I'm not familiar with, so I've not been able to construct a test case for it. Perhaps someone else can. llvm-svn: 154325
* 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
OpenPOWER on IntegriCloud