Ted Kremenek [Mon, 11 Jan 2010 00:07:44 +0000 (00:07 +0000)]
Preliminary reworking of value-binding logic in RegionStore:
(1) Introduce a new 'BindingKey' class to match 'BindingValue'. This
gives us the flexibility to change the current key value from 'const
MemRegion*' to something more interesting.
(2) Rework additions/removals/lookups from the store to use new
'Remove', 'Add', 'Lookup' utility methods.
No "real" functionality change; just prep work and abstraction.
Sean Hunt [Sun, 10 Jan 2010 23:37:56 +0000 (23:37 +0000)]
Do not parse hexadecimal floating point literals in C++0x mode because they are
incompatible with user-defined literals, specifically with the following form:
0x1p+1
The preprocessing-number token extends only as far as the 'p'; the '+' is not
included. Previously we could get away with this extension as p was an invalid
suffix, but now with user-defined literals, 'p' might well be a valid suffix
and we are forced to consider it as such.
This patch also adds a warning in non-0x C++ modes telling the user that
this extension is incompatible with C++0x that is enabled by default
(previously and with other languages, we warn only with a compliance
option such as -pedantic).
Douglas Gregor [Sun, 10 Jan 2010 23:08:15 +0000 (23:08 +0000)]
Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for
static_cast<type>(expr)
when we can have an expression, or
using namespace identifier;
when we can have a using directive.
Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.
Generalize target weirdness handling having proper layering in mind:
1. Add helper class for sema checks for target attributes
2. Add helper class for codegen of target attributes
As a proof-of-concept - implement msp430's 'interrupt' attribute.
Chris Lattner [Sun, 10 Jan 2010 00:24:58 +0000 (00:24 +0000)]
implement rdar://7520940: published framework headers should
import other headers within the same framework with the full
framework path, not with a relative include.
Ted Kremenek [Sat, 9 Jan 2010 22:58:54 +0000 (22:58 +0000)]
Fix overzealous assertion in GRExprEngine::VisitLValue(). A
CallExpr/ObjCMessageExpr can be visited in an "lvalue" context if it
returns a struct temporary. Currently the analyzer doesn't reason
about struct temporary returned by function calls, but we shouldn't
crash here either.
Benjamin Kramer [Sat, 9 Jan 2010 16:17:37 +0000 (16:17 +0000)]
Rework InitPreprocessor to use a MacroBuilder class instead of pushing around
std::vectors.
- MacroBuilder wraps a raw_ostream so it can easily write to any buffer
supported by raw_ostream.
- MacroBuilder's method take Twines for easy string concatenation (this was done
with sprintf and temporary buffers before).
- Targets still use std::vector as they don't have access to the builder.
Ted Kremenek [Fri, 8 Jan 2010 18:54:04 +0000 (18:54 +0000)]
Fix handling in GRExprEngine of 'default' branch in switch statements
when the default case is winnowed down to be infeasible. When all
cases were ruled out (and the analysis state for the default case
would be infeasible) we would still consider the default case
possible. This fixes PR 5969.
John McCall [Fri, 8 Jan 2010 04:41:39 +0000 (04:41 +0000)]
Change the printing of OR_Deleted overload results to print all the candidates,
not just the viable ones. This is reasonable because the most common use of
deleted functions is to exclude some implicit conversion during calls; users
therefore will want to figure out why some other options were excluded.
Started sorting overload results. Right now it just sorts by location in the
translation unit (after putting viable functions first), but we can do better than
that.
Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better
self-documentation.
Eli Friedman [Fri, 8 Jan 2010 00:50:11 +0000 (00:50 +0000)]
Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.
Douglas Gregor [Fri, 8 Jan 2010 00:20:23 +0000 (00:20 +0000)]
Improve the fix-its for -Wparentheses to ensure that the fix-it
suggestions follow recovery. Additionally, add a note to these
diagnostics which suggests a fix-it for changing the behavior to what
the user probably meant. Examples:
t.cpp:2:9: warning: & has lower precedence than ==; == will be evaluated first
[-Wparentheses]
if (i & j == k) {
^~~~~~~~
( )
t.cpp:2:9: note: place parentheses around the & expression to evaluate it first
if (i & j == k) {
^
( )
t.cpp:14:9: warning: using the result of an assignment as a condition
without
parentheses [-Wparentheses]
if (i = f()) {
~~^~~~~
( )
t.cpp:14:9: note: use '==' to turn this assignment into an equality
comparison
if (i = f()) {
^
==
Douglas Gregor [Thu, 7 Jan 2010 23:12:05 +0000 (23:12 +0000)]
Add an "implicit" bit to CXXThisExpr, so that we can track
implicitness without losing track of the (logical or actual) location
where "this" would occur in the source.
John McCall [Thu, 7 Jan 2010 19:29:58 +0000 (19:29 +0000)]
When parsing an identifier as an expression in C++, only try to annotate it
as a type or scope token if the next token requires it.
This eliminates a lot of redundant lookups in C++, but there's room for
improvement; a better solution would do a single lookup whose kind and
results would be passed through the parser.
John McCall [Thu, 7 Jan 2010 02:04:15 +0000 (02:04 +0000)]
Improve the lead diagnostic for C++ object subscript expressions with
no viable overloads. Use a different message when the class provides
no operator[] overloads at all; use it for operator(), too.
Ted Kremenek [Thu, 7 Jan 2010 01:20:12 +0000 (01:20 +0000)]
Change ObjCContainerDecl to contain the entire range for the '@end'
piece of the declaration. The '@' and the 'end' are separate tokens,
and require two SourceLocations to accurately track.
This change was motivated because ObjCContainerDecl::getSourceRange()
would previously not return the entire range of the declaration (the
'end' would be left off).
Douglas Gregor [Thu, 7 Jan 2010 00:31:29 +0000 (00:31 +0000)]
Fix the search for visible declarations within a Scope to ensure that
we look into a Scope that corresponds to a compound statement whose
scope was combined with the scope of the function that owns it. This
improves typo correction in many common cases.
Douglas Gregor [Wed, 6 Jan 2010 23:44:25 +0000 (23:44 +0000)]
When suggesting a typo correction for an @implementation without a
corresponding @interface, provide a note showing which interface we're
referring to. This note has the fix-it hint on it.
Also, don't automatically apply fix-it hints for notes. They're meant
to express fix-its that would change semantics.
Douglas Gregor [Wed, 6 Jan 2010 22:00:56 +0000 (22:00 +0000)]
Fix linkage for RTTI names by re-using the logic for computing the
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.
Fix a bug when property is redeclared in multiple
continuation classes and its original declaration
is imported from a protocol. This fixes radar 7509234.
Douglas Gregor [Wed, 6 Jan 2010 17:00:51 +0000 (17:00 +0000)]
Make sure that the key-function computation produces the correct
result for a nested class whose first non-pure virtual member function
has an inline body. Previously, we were checking for the key function
before we had seen the (delayed) inline body.
John McCall [Wed, 6 Jan 2010 09:43:14 +0000 (09:43 +0000)]
Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets. Also, refer to constructors as 'constructors'
rather than functions.
John McCall [Wed, 6 Jan 2010 05:24:50 +0000 (05:24 +0000)]
Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics. The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.