Douglas Gregor [Thu, 9 Feb 2012 00:47:04 +0000 (00:47 +0000)]
Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression
(previously, it was left in the "being completed" state)
- Actually return the LambdaExpr object and bind to the resulting
temporary when needed.
- Detect when cleanups are needed while capturing a variable into a
lambda (e.g., due to default arguments in the copy constructor), and
make sure those cleanups apply for the whole of the lambda
expression.
Anna Zaks [Wed, 8 Feb 2012 23:16:56 +0000 (23:16 +0000)]
[analyzer] MallocChecker: implement pessimistic version of the checker,
which allows values to escape through unknown calls.
Assumes all calls but the malloc family are unknown.
Also, catch a use-after-free when a pointer is passed to a
function after a call to free (previously, you had to explicitly
dereference the pointer value).
Douglas Gregor [Wed, 8 Feb 2012 20:56:50 +0000 (20:56 +0000)]
When computing the type of a local variable reference within a lambda,
only add 'const' for variables captured by copy in potentially
evaluated expressions of non-mutable lambdas. (The "by copy" part was
missing).
Richard Smith [Wed, 8 Feb 2012 08:11:33 +0000 (08:11 +0000)]
Implement DR1458: Taking the address of an object of incomplete class type is
not a constant expression, because we can't tell whether the complete class type
will have an overloaded operator&.
Richard Smith [Wed, 8 Feb 2012 06:14:53 +0000 (06:14 +0000)]
Implement the agreed resolution to DR1457: a signed left shift of a 1 bit into
the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit
out of the sign bit still does. As promised to Howard :)
The suppression of the potential constant expression checking in system headers
is also removed, since the problem it was working around is gone.
Ted Kremenek [Wed, 8 Feb 2012 05:08:58 +0000 (05:08 +0000)]
Move -Wcovered-switch-default out of -Wswitch (and -Wall), and make it an opt-in warning.
This is a great warning, but it was observed that a ton of real world code violates
it all the time for (semi-)legitimate reasons. This warnings is fairly pedantic, which is good,
but not for everyone. For example, there is a fair amount of idiomatic code out there
that does "default: abort()", and similar idioms.
Ted Kremenek [Wed, 8 Feb 2012 04:32:34 +0000 (04:32 +0000)]
Change PathDiagnosticPieces to be reference counted (simplifying their management), and introduce 'PathPieces' as a common container for PathDiagnosticPieces.
[libclang] For CXXOperatorCallExprs, give a valid source location to the DeclRefExpr
that is referencing the member function, so we can index the referenced function.
John McCall [Wed, 8 Feb 2012 00:46:36 +0000 (00:46 +0000)]
Revise the SplitQualType interface to make it its own thing instead of
a typedef of std::pair. This slightly improves type-safety, but mostly
makes code using it clearer to read as well as making it possible to add
methods to the type.
Add such a method for efficiently single-step desugaring a split type.
Add a method to single-step desugaring a locally-unqualified type.
Implement both the SplitQualType and QualType methods in terms of that.
Sean Callanan [Wed, 8 Feb 2012 00:04:52 +0000 (00:04 +0000)]
If a struct needs to be laid out, and it has not
been completed yet, then complete it if possible.
This fixes some assertion failures encountered by
LLDB.
Benjamin Kramer [Tue, 7 Feb 2012 22:29:24 +0000 (22:29 +0000)]
Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.
Chad Rosier [Tue, 7 Feb 2012 19:55:45 +0000 (19:55 +0000)]
In r149662, setDiagnosticMapping was modified to not allow warnings mapped to
MAP_ERROR to be remapped to MAP_WARNING. These new APIs are being added to
allow the diagnostic mapping's "no Werror" bit to be set, and potentially
downgrade anything already mapped to be a warning.
Make parsing of objc @implementations more robust.
Parsing of @implementations was based on modifying global state from
the parser; the logic for late parsing of methods was spread in multiple places
making it difficult to have a robust error recovery.
-it was difficult to ensure that we don't neglect parsing the lexed methods.
-it was difficult to setup the original objc container context for parsing the lexed methods
after completing ParseObjCAtImplementationDeclaration and returning to top level context.
Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration().
ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed;
all the data and logic for late parsing of methods is now in one place.
This allows us to provide code-completion for late parsed methods with mis-matched braces.
rdar://10775381
Douglas Gregor [Tue, 7 Feb 2012 10:09:13 +0000 (10:09 +0000)]
Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
- The representation of lambda captures
- The creation of the non-static data members in the lambda class
that store the captured variables
- The initialization of the non-static data members from the
captured variables
- Pretty-printing lambda expressions
There are a number of FIXMEs, both explicit and implied, including:
- Creating a field for a capture of 'this'
- Improved diagnostics for initialization failures when capturing
variables by copy
- Dealing with temporaries created during said initialization
- Template instantiation
- AST (de-)serialization
- Binding and returning the lambda expression; turning it into a
proper temporary
- Lots and lots of semantic constraints
- Parameter pack captures
Eli Friedman [Tue, 7 Feb 2012 03:50:18 +0000 (03:50 +0000)]
Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition. Based on work by Anton Yartsev.
Kaelyn Uhrain [Tue, 7 Feb 2012 01:32:58 +0000 (01:32 +0000)]
Remove the unused TypoCorrectionConsumer::MaxEditDistance.
MaxEditDistance was effectively unused as it being initialized to the max
unsigned valued but never updated. Removing it avoids conversion
headaches once the "edit distance" of a typo correction is a weighted
composite of several values instead of roughly the number of characters
changed; comparing the weighted composite value to the number of
characters in a typo would require some form of normalization to make it
comparable to the old, character-based notion of edit distance.
Abramo Bagnara [Mon, 6 Feb 2012 22:45:07 +0000 (22:45 +0000)]
Added source location for the template keyword in DependentTemplateSpecializationTypeLoc nodes (DTSTLoc).
The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp.
Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions).
Rewrite the debug action handling to take -verify into account.
Add a quiet option for dwarfdump and move it out of NDEBUG only.
Still requires an option as we don't want this on by default.
objc: fixes a problem in block type comparison involving
enums with underlying type explicitly specified
(feature which is on by default in objective-c).
// rdar://10798770
Benjamin Kramer [Mon, 6 Feb 2012 15:33:06 +0000 (15:33 +0000)]
- Turn the other distribution checks into range compares.
- Turn openSUSE version parsing into a StringSwitch
- Add an entry for Fedora release 16 (Verne)