summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ArrayRef'ize some SemaOverload methodsDmitri Gribenko2013-05-091-46/+42
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181544
* CodeGen for CapturedStmtsBen Langmuir2013-05-091-5/+5
| | | | | | | | | | | | | | | | | EmitCapturedStmt creates a captured struct containing all of the captured variables, and then emits a call to the outlined function. This is similar in principle to EmitBlockLiteral. GenerateCapturedFunction actually produces the outlined function. It is based on GenerateBlockFunction, but is much simpler. The function type is determined by the parameters that are in the CapturedDecl. Some changes have been added to this patch that were reviewed as part of the serialization patch and moving the parameters to the captured decl. Differential Revision: http://llvm-reviews.chandlerc.com/D640 llvm-svn: 181536
* Grab-bag of bit-field fixes:John McCall2013-05-061-1/+1
| | | | | | | | | | | | | | - References to ObjC bit-field ivars are bit-field lvalues; fixes rdar://13794269, which got me started down this. - Introduce Expr::refersToBitField, switch a couple users to it where semantically important, and comment the difference between this and the existing API. - Discourage Expr::getBitField by making it a bit longer and less general-sounding. - Lock down on const_casts of bit-field gl-values until we hear back from the committee as to whether they're allowed. llvm-svn: 181252
* Fix representation of compound literals for C++ objects with destructors.Jordan Rose2013-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, this compound literal expression (a GNU extension in C++): (AggregateWithDtor){1, 2} resulted in this AST: `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...]) `-CompoundLiteralExpr [...] 'struct AggregateWithDtor' `-CXXBindTemporaryExpr [...] 'struct AggregateWithDtor' (CXXTemporary [...]) `-InitListExpr [...] 'struct AggregateWithDtor' |-IntegerLiteral [...] 'int' 1 `-IntegerLiteral [...] 'int' 2 Note the two CXXBindTemporaryExprs. The InitListExpr is really part of the CompoundLiteralExpr, not an object in its own right. By introducing a new entity initialization kind in Sema specifically for compound literals, we avoid the treatment of the inner InitListExpr as a temporary. `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...]) `-CompoundLiteralExpr [...] 'struct AggregateWithDtor' `-InitListExpr [...] 'struct AggregateWithDtor' |-IntegerLiteral [...] 'int' 1 `-IntegerLiteral [...] 'int' 2 llvm-svn: 181212
* Require the containing type to be complete when we seeJohn McCall2013-05-061-19/+54
| | | | | | | | | | | | __alignof__ of a field. This problem can only happen in C++11. Also do some petty optimizations. rdar://13784901 llvm-svn: 181185
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-2/+2
| | | | llvm-svn: 181166
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-5/+5
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Implement most of N3638 (return type deduction for normal functions).Richard Smith2013-05-041-0/+12
| | | | | | | Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. llvm-svn: 181108
* ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!Richard Smith2013-05-031-6/+3
| | | | llvm-svn: 181077
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-031-12/+9
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-4/+6
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* PR15884: In the 'taking the address of a temporary' extension, materialize theRichard Smith2013-05-011-0/+3
| | | | | | | | temporary to an lvalue before taking its address. This removes a weird special case from the AST representation, and allows the constant expression evaluator to deal with it without (broken) hacks. llvm-svn: 180866
* Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers Fariborz Jahanian2013-04-301-0/+4
| | | | | | | in the diagnostics. Remove them when reporting incompatible Objective-C pointer types. // rdar://13752880. llvm-svn: 180765
* Fix an assertion failure / accepts-invalid in -fms-extensions mode. Don't buildRichard Smith2013-04-291-8/+10
| | | | | | | | | a dependent-scope id expression when a templated member function of a non-templated class references an unknown identifier, since instantiation won't rebuild it (and we can tell at parse time that it'll never work). Based on a patch by Faisal Vali! llvm-svn: 180701
* Add a warning for Objective-C pointer introspection, which is solely the job ↵Ted Kremenek2013-04-221-0/+31
| | | | | | of the Objective-C runtime. llvm-svn: 180062
* Switch the note order for -Woverloaded-shift-op-parentheses so that the noteRichard Trieu2013-04-181-4/+4
| | | | | | | with the silence fix-it comes first. This is more consistent with the rest of the warnings in -Wparentheses. llvm-svn: 179742
* Add warning group -Woverloaded-shift-op-parentheses to -Wparentheses. ThisRichard Trieu2013-04-171-0/+32
| | | | | | | | | | | | | | | will fire on code such as: cout << x == 0; which the compiler will intrepret as (cout << x) == 0; This warning comes with two fixits attached to notes, one for parentheses to silence the warning, and another to evaluate the comparison first. llvm-svn: 179662
* Sema for Captured StatementsTareq A. Siraj2013-04-161-6/+57
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Fix handling of atomic shift operations, from Serge Pavlov.Douglas Gregor2013-04-161-12/+12
| | | | llvm-svn: 179600
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+69
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Remove some dead code that has not been used since 2010.Joey Gouly2013-04-151-11/+0
| | | | llvm-svn: 179558
* Update OpenCL comments to mention spec section and version.Tanya Lattner2013-04-031-3/+3
| | | | llvm-svn: 178716
* Add 178663 back.Rafael Espindola2013-04-031-2/+2
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-2/+2
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-2/+2
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Objective-C: Provide fixit hints when warningFariborz Jahanian2013-04-021-6/+34
| | | | | | | | about 'isa' ivar being explicitely accessed when base is a user class object reference. // rdar://13503456 llvm-svn: 178562
* Add -Wstatic-local-in-inline, which warns about using a static localJohn McCall2013-04-021-7/+12
| | | | | | | | | | | | | | variable in a C99 inline (but not static-inline or extern-inline) function definition. The standard doesn't actually say that this doesn't apply to "extern inline" definitions, but that seems like a useful extension, and it at least doesn't have the obvious flaw that a static mutable variable in an externally-available definition does. rdar://13535367 llvm-svn: 178520
* Sema: Don't crash when trying to emit a precedence warning on postinc/decrement.Benjamin Kramer2013-03-301-1/+2
| | | | | | | | | Post-Inc can occur as a binary call (the infamous dummy int argument), but it's not really a binary operator. Fixes PR15628. llvm-svn: 178412
* Sema: Warn on sizeof on binary ops on decayed arrays.Benjamin Kramer2013-03-291-0/+28
| | | | | | | | | | | | | The array will decay into a pointer, creating an unexpected result. sizeof(array + int) is an easy to make typo for sizeof(array) + int. This was motivated by a NetBSD security bug, used sizeof(key - r) instead of sizeof(key) - r, reducing entropy in a random number generator. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/subr_cprng.c.diff?r1=1.14&r2=1.15&only_with_tag=MAIN&f=h Differential Revision: http://llvm-reviews.chandlerc.com/D571 llvm-svn: 178371
* Objective-C: Produce precise diagnostic whenFariborz Jahanian2013-03-281-2/+36
| | | | | | | | 'isa' ivar is accessed provided it is the first ivar. Fixit hint will follow in another patch. This is continuation of // rdar://13503456 llvm-svn: 178313
* Objective-C: Provide fixit suggestions when class objectFariborz Jahanian2013-03-281-4/+26
| | | | | | | | is accessed via accessing 'isa' ivar to use object_getClass/object_setClass apis. // rdar://13503456 llvm-svn: 178282
* Objective-C: Issue more precise warning when userFariborz Jahanian2013-03-271-0/+5
| | | | | | | is accessing 'isa' as an object pointer. // rdar://13503456. FixIt to follow in another patch. llvm-svn: 178179
* <rdar://problem/13473493> Handle 'this->' insertion recovery within trailing ↵Douglas Gregor2013-03-261-2/+3
| | | | | | return types. llvm-svn: 178081
* Fix DeclRefExpr::getFoundDecl() for usages by reference.Daniel Jasper2013-03-221-6/+6
| | | | llvm-svn: 177721
* Fix a crash-on-valid where a block capture copy expression wasJohn McCall2013-03-221-3/+5
| | | | | | | | | | | | picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. llvm-svn: 177692
* Add a clarifying note when a return statement is rejected becauseJohn McCall2013-03-191-0/+3
| | | | | | | | we expect a related result type. rdar://12493140 llvm-svn: 177378
* Diagnose uses of 'alignof' on functions in -pedantic mode.Richard Smith2013-03-181-5/+6
| | | | llvm-svn: 177354
* Bring inheriting constructor implementation up-to-date with current defectRichard Smith2013-03-181-0/+3
| | | | | | | | | reports, and implement implicit definition of inheriting constructors. Remaining missing features: inheriting constructor templates, implicit exception specifications for inheriting constructors, inheriting constructors from dependent bases. llvm-svn: 177320
* Add some assertions to appease the static analyzer.Jordan Rose2013-03-151-0/+1
| | | | | | No functionality change. llvm-svn: 177185
* Avoid computing the linkage too early. Don't invalidate it.Rafael Espindola2013-03-141-1/+1
| | | | | | | | | | | | | | | | | | Before this patch we would compute the linkage lazily and cache it. When the AST was modified in ways that could change the value, we would invalidate the cache. That was fairly brittle, since any code could ask for the a linkage before the correct value was available. We should change the API to one where the linkage is computed explicitly and trying to get it when it is not available asserts. This patch is a first step in that direction. We still compute the linkage lazily, but instead of invalidating a cache, we assert that the AST modifications didn't change the result. llvm-svn: 176999
* ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.Jordan Rose2013-03-081-12/+13
| | | | | | No (intended) functionality change. llvm-svn: 176726
* objective-C: don't crash after diagnosingFariborz Jahanian2013-03-061-2/+2
| | | | | | | using object subscripting without declaring objectForKeyedSubscript: // rdar://13333205 llvm-svn: 176539
* Centralize and refine the __unknown_anytype argument rulesJohn McCall2013-03-041-17/+21
| | | | | | | | | and be sure to apply them whether or not the debugger gave us a method declaration. rdar://12565338 llvm-svn: 176432
* Perform non-overload placeholder conversions on the operandsJohn McCall2013-03-041-16/+39
| | | | | | | | to a subscript operator. rdar://13332183 llvm-svn: 176428
* Remove superfluous null pointer check. The pointer is used prior to this check.Ted Kremenek2013-02-211-7/+6
| | | | llvm-svn: 175807
* Teach serialized diagnostics about notes without locations.Ted Kremenek2013-02-211-2/+7
| | | | | | | | Along the way, improve a diagnostic for "previous declaration here" for implicit parameters. Fixes <rdar://problem/13211384>. llvm-svn: 175802
* Add support to Sema and CodeGen for floating point vector types in OpenCL.Joey Gouly2013-02-211-6/+45
| | | | llvm-svn: 175734
* Avoid implicit conversions of Optional<T> to bool.David Blaikie2013-02-211-3/+3
| | | | | | | This is a precursor to making Optional<T>'s operator bool 'explicit' when building Clang & LLVM as C++11. llvm-svn: 175722
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-4/+3
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Prevent crash on multiple user errors (which I cannot reproduce inFariborz Jahanian2013-02-181-0/+4
| | | | | | a small test case). // rdar://13178483. llvm-svn: 175450
OpenPOWER on IntegriCloud