summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* more objective-c translator for modern abi.Fariborz Jahanian2012-02-141-1/+19
| | | | | | | metadata for protocol definitions used on class qualifiers. llvm-svn: 150498
* Implement support for lambda capture pack expansions, e.g.,Douglas Gregor2012-02-144-13/+73
| | | | | | [&values...] { print(values...); } llvm-svn: 150497
* Use several weighted factors to determine typo candidate viablity.Kaelyn Uhrain2012-02-141-42/+35
| | | | | | | | | | | Replace the simple Levenshtein edit distance for typo correction candidates--and the hacky way adding namespace qualifiers would affect the edit distance--with a synthetic "edit distance" comprised of several factors and their relative weights. This also allows the typo correction callback object to convey more information about the viability of a correction candidate than simply viable or not viable. llvm-svn: 150495
* Implement AST (de-)serialization for lambda expressions.Douglas Gregor2012-02-145-3/+124
| | | | llvm-svn: 150491
* more modern objc translator. Focusing on metadata for methods.Fariborz Jahanian2012-02-141-17/+61
| | | | llvm-svn: 150490
* include clang's config.h unconditionally (v2)Dylan Noblesmith2012-02-143-14/+4
| | | | | | | | | | And remove HAVE_CLANG_CONFIG_H, now that the header is generated in the autoconf build, too. Reverts r149571/restores r149504, now that config.h is generated correctly by LLVM's configure in all build configurations. llvm-svn: 150487
* Use a simpler (and more efficient) pattern to pad vectors.Benjamin Kramer2012-02-145-25/+14
| | | | llvm-svn: 150475
* Fix crash-on-invalid for 'operator int[]()' in C++11.David Blaikie2012-02-141-3/+4
| | | | | | Signed off by Richard Smith. llvm-svn: 150464
* Remove useless if statement.Eli Friedman2012-02-141-19/+14
| | | | llvm-svn: 150459
* Refactor DiagnosticRenderer and SDiagsRenderer to have some functionalityTed Kremenek2012-02-143-34/+38
| | | | | | | | | pulled into DiagnosticNoteRenderer, and common DiagnosticRenderer that assumes that all custom diagnostic messages are notes. Also extend DiagnosticRenderer to work with StoredDiagnostics in preparation for subsequent changes. llvm-svn: 150455
* Fix another issue introduced by the proposed wording for core issue 1358: sinceRichard Smith2012-02-141-3/+12
| | | | | | | | | | the instantiation of a constexpr function temploid is now always constexpr, a defaulted constexpr function temploid is often ill-formed by the rule in [dcl.fct.def.default]p2 that an explicitly-defaulted constexpr function must have a constexpr implicit definition. To avoid making loads of completely reasonable code ill-formed, do not apply that rule to templates. llvm-svn: 150453
* Implement IRGen of lambda expressions which capture arrays.Eli Friedman2012-02-143-63/+29
| | | | llvm-svn: 150452
* Refactor out new function EmitInitializerForField from ↵Eli Friedman2012-02-141-50/+69
| | | | | | EmitMemberInitializer. The new function will be used to initialize the fields of lambda expressions. llvm-svn: 150451
* [analyzer] Malloc Checker: realloc: add dependency between the symbolsAnna Zaks2012-02-141-9/+6
| | | | | | | | | | | | | in realloc map. If there is no dependency, the reallocated ptr will get garbage collected before we know that realloc failed, which would lead us to missing a memory leak warning. Also added new test cases, which we can handle now. Plus minor cleanups. llvm-svn: 150446
* Link together the call operator produced from transforming a lambdaDouglas Gregor2012-02-142-24/+28
| | | | | | | | expression with the original call operator, so that we don't try to separately instantiate the call operator. Test and tweak a few more bits for template instantiation of lambda expressions. llvm-svn: 150440
* Mark the cxa_guard_{abort,acquire,release} functions nounwind.Nick Lewycky2012-02-131-3/+6
| | | | llvm-svn: 150435
* Deal with a horrible C++11 special case. If a non-literal type has a constexprRichard Smith2012-02-1311-43/+92
| | | | | | | | | | | constructor, and that constructor is used to initialize an object of static storage duration such that all members and bases are initialized by constant expressions, constant initialization is performed. In this case, the object can still have a non-trivial destructor, and if it does, we must emit a dynamic initializer which performs no initialization and instead simply registers that destructor. llvm-svn: 150419
* Introduce support for template instantiation of lambdaDouglas Gregor2012-02-138-98/+293
| | | | | | | | | | | | | | | | | | expressions. This is mostly a simple refact, splitting the main "start a lambda expression" function into smaller chunks that are driven either from the parser (Sema::ActOnLambdaExpr) or during AST transformation (TreeTransform::TransformLambdaExpr). A few minor interesting points: - Added new entry points for TreeTransform, so that we can explicitly establish the link between the lambda closure type in the template and the lambda closure type in the instantiation. - Added a bit into LambdaExpr specifying whether it had an explicit result type or not. We should have had this anyway. This code is 'lightly' tested. llvm-svn: 150417
* modern objc translator. More ivar rewrite work.Fariborz Jahanian2012-02-131-14/+17
| | | | llvm-svn: 150415
* objc modern translator. ivar offset symbols.Fariborz Jahanian2012-02-131-2/+40
| | | | llvm-svn: 150413
* [analyzer] Malloc Checker: realloc: correct the way we are handing theAnna Zaks2012-02-131-8/+9
| | | | | | case when size is 0. llvm-svn: 150412
* Don't route explicit construction via list-initialization through the ↵Sebastian Redl2012-02-132-16/+33
| | | | | | functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary. llvm-svn: 150408
* Sink variable into assertMatt Beaumont-Gay2012-02-131-2/+2
| | | | llvm-svn: 150407
* objective-c translator: more rewriting of ivar typesFariborz Jahanian2012-02-131-8/+29
| | | | | | into a c-type which closely matches the objective-c type. llvm-svn: 150406
* When generating diagnostic information due to a clang failure, allow multipleChad Rosier2012-02-131-9/+10
| | | | | | | | | -arch options if the're all the same. Patch by Jeremy Huddleston. rdar://10849701 llvm-svn: 150403
* [analyzer] Malloc checker: rework realloc handling:Anna Zaks2012-02-131-34/+80
| | | | | | | | | | | | | | | | | | | 1) Support the case when realloc fails to reduce False Positives. (We essentially need to restore the state of the pointer being reallocated.) 2) Realloc behaves differently under special conditions (from pointer is null, size is 0). When detecting these cases, we should consider under-constrained states (size might or might not be 0). The old version handled this in a very hacky way. The code did not differentiate between definite and possible (no consideration for under-constrained states). Further, after processing each special case, the realloc processing function did not return but chained to the next special case processing. So you could end up in an execution in which you first see the states in which size is 0 and realloc ~ free(), followed by the states corresponding to size is not 0 followed by the evaluation of the regular realloc behavior. llvm-svn: 150402
* Split the storage of lambda information between the LambdaExpr and theDouglas Gregor2012-02-132-92/+53
| | | | | | | | | | | | CXXRecordDecl in a way that actually makes some sense: - LambdaExpr contains all of the information for initializing the lambda object, including the capture initializers and associated array index variables. - CXXRecordDecl's LambdaDefinitionData contains the captures, which are needed to understand the captured variable references in the body of the lambda. llvm-svn: 150401
* Keep track of the set of array index variables we use when weDouglas Gregor2012-02-134-4/+49
| | | | | | | synthesize a by-copy captured array in a lambda. This information will be needed by IR generation. llvm-svn: 150396
* Don't allocate unused storage for captures/capture initializers in lambda ↵Douglas Gregor2012-02-131-6/+3
| | | | | | expressions llvm-svn: 150394
* Move the storage of lambda captures and capture initializers fromDouglas Gregor2012-02-133-37/+100
| | | | | | | | LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the back-link from the closure type to the LambdaExpr, which will simplify and lazify AST deserialization. llvm-svn: 150393
* Add back in the code to create forward decls using temporary mdnodes.Eric Christopher2012-02-131-13/+14
| | | | llvm-svn: 150390
* Temporarily walk back a few of my recent debug info limiting changesEric Christopher2012-02-132-106/+24
| | | | | | | | while reworking how we handle wanting to emit only parts of structures. Fixes PR11970. llvm-svn: 150388
* Update constexpr implementation to match CWG's chosen approach for core issuesRichard Smith2012-02-136-137/+83
| | | | | | | | | | | | | | | | | | | | 1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for separate declaration/definition checking, which is now gone. - This makes it possible for a constexpr function to be virtual, if they are only dependently virtual. Virtual calls to such functions are not constant expressions. - Likewise, it's now possible for a literal type to have virtual base classes. A constexpr constructor for such a type cannot actually produce a constant expression, though, so add a special-case diagnostic for a constructor call to such a type rather than trying to evaluate it. - Classes with trivial default constructors (for which value initialization can produce a fully-initialized value) are considered literal types. - Classes with volatile members are not literal types. - constexpr constructors can be members of non-literal types. We do not yet use static initialization for global objects constructed in this way. llvm-svn: 150359
* Delete a simplistic helper function now that llvm::Triple can provideChandler Carruth2012-02-131-13/+3
| | | | | | this functionality. llvm-svn: 150358
* more of rewriting ivar types.Fariborz Jahanian2012-02-121-2/+6
| | | | llvm-svn: 150353
* Implement the standard decltype() semantics described in C++11Douglas Gregor2012-02-121-14/+22
| | | | | | | | [dcl.type.simple]p4, which treats all xvalues as returning T&&. We had previously implemented a pre-standard variant of decltype() that doesn't cope with, e.g., static_ast<T&&>(e) very well. llvm-svn: 150348
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-126-118/+223
| | | | | | | | | | | | | | | | id-expression 'x' will compute the type based on the assumption that 'x' will be captured, even if it isn't captured, per C++11 [expr.prim.lambda]p18. There are two related refactors that go into implementing this: 1) Split out the check that determines whether we should capture a particular variable reference, along with the computation of the type of the field, from the actual act of capturing the variable. 2) Always compute the result of decltype() within Sema, rather than AST, because the decltype() computation is now context-sensitive. llvm-svn: 150347
* Proper initializer list support for new expressions and type construct ↵Sebastian Redl2012-02-123-41/+83
| | | | | | expressions. Array new still missing. llvm-svn: 150346
* Lambdas have a deleted default constructor and a deleted copyDouglas Gregor2012-02-123-7/+21
| | | | | | assignment operator, per C++ [expr.prim.lambda]p19. Make it so. llvm-svn: 150345
* Change the way we store initialization kinds so that all direct inits can ↵Sebastian Redl2012-02-124-31/+49
| | | | | | distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb. llvm-svn: 150343
* Employ DirectList initialized entities to properly sort through some ↵Sebastian Redl2012-02-122-15/+27
| | | | | | initialization edge cases. llvm-svn: 150342
* Fix the rewriter that broke with r149987.Argyrios Kyrtzidis2012-02-122-0/+6
| | | | | | | | | | | | | r149987 changed the way parsing happens inside an @implementation; it aggregates the declarations inside and reports them together as a DeclGroup. This had the side effect that function declarations were reported together with their definition, while the rewriter expected for function declarations to be reported immediately to the consumer and thus not have a body. Fix this by having the rewriter actually check with isThisDeclarationADefinition() to make sure the body comes from the current decl before rewriting it. llvm-svn: 150325
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-1118-540/+310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* Drive-by fix of incorrect diagnostic, and a test case for said diagnostic. ↵Sebastian Redl2012-02-111-2/+2
| | | | | | The double error is unfortunate, but I really don't see an alternative whose effort is worth it. llvm-svn: 150317
* Fix parsing new expressions using init lists. Probably still do the wrong ↵Sebastian Redl2012-02-112-6/+86
| | | | | | | | thing in cases involving array new. Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis. llvm-svn: 150316
* [analyzer] Malloc Checker: reduce false negatives rate by assuming thatAnna Zaks2012-02-111-6/+28
| | | | | | | a pointer cannot escape through calls to system functions. Also, stop after reporting the first use-after-free. llvm-svn: 150315
* [analyzer] Malloc Checker: Report a leak when we are returning freedAnna Zaks2012-02-111-0/+6
| | | | | | | | | memory. (As per one test case, the existing checker thought that this could cause a lot of false positives - not sure if that's valid, to be verified.) llvm-svn: 150313
* [analyzer] Malloc checker: Leak bugs should be suppressed by sinks.Anna Zaks2012-02-111-18/+28
| | | | | | | Resolves a common false positive, where we were reporting a leak inside asserts llvm-svn: 150312
* [analyzer] MallocChecker: refactor/improve the symbol escape logic.Anna Zaks2012-02-111-71/+103
| | | | | | We use the same logic here as the RetainRelease checker. llvm-svn: 150311
* objective-c translator. more modern abi stuff, focusing on ivar relatedFariborz Jahanian2012-02-111-246/+33
| | | | | | meta-data. llvm-svn: 150310
OpenPOWER on IntegriCloud