Ted Kremenek [Wed, 18 Feb 2009 22:57:22 +0000 (22:57 +0000)]
More fun with retain checker diagnostics:
- Fix some grammar.
- Fix a bug where a "reference count incremented" diagnostic would not be shown
if the previous typestate was "Released" (only happens in GC mode).
Chris Lattner [Wed, 18 Feb 2009 22:53:11 +0000 (22:53 +0000)]
fix some subtle bugs handling the mix of cvr qualifiers, addr spaces,
and gc attrs. Add an assert to check that we never
get ExtQualType(ExtQualType(T)).
Douglas Gregor [Wed, 18 Feb 2009 21:56:37 +0000 (21:56 +0000)]
Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and
found an unavailable function: in this case, we actually error.
Merge the checking of unavailable functions with the checking for
deprecated functions. This unifies a bit of code, and makes sure that
we're checking for unavailable functions in the right places. Also,
this check can cause an error. We may, eventually, want an option to
make "unavailable" warnings into errors.
Implement much of the logic needed for C++0x deleted functions, which
are effectively the same as "unavailable" functions (but always cause
an error when referenced). However, we don't have the syntax to
specify deleted functions yet :)
Ted Kremenek [Wed, 18 Feb 2009 18:54:33 +0000 (18:54 +0000)]
retain/release checker: Distinguish in the function summaries between
retain/releases performed via [... release] and CFRetain(). The former are
no-ops in GC. The checker already handled this, but now we emit nice diagnostics
to the user telling them that these are no-ops.
Chris Lattner [Wed, 18 Feb 2009 18:52:52 +0000 (18:52 +0000)]
Fix some issues handling sub-token locations that come from macro expansions.
We now emit:
t.m:6:15: warning: field width should have type 'int', but argument has type 'unsigned int'
printf(STR, (unsigned) 1, 1);
^ ~~~~~~~~~~~~
t.m:3:18: note: instantiated from:
#define STR "abc%*ddef"
^
which has the correct location in the string literal in the note line.
Chris Lattner [Wed, 18 Feb 2009 17:49:48 +0000 (17:49 +0000)]
Start improving diagnostics that relate to subcharacters of string literals.
First step, handle diagnostics in StringLiteral's that are due to token pasting.
For example, we now handle:
id str2 = @"foo"
"bar"
@"baz"
" b\0larg"; // expected-warning {{literal contains NUL character}}
Douglas Gregor [Wed, 18 Feb 2009 17:45:20 +0000 (17:45 +0000)]
Update Parser::ParseTypeName to return a TypeResult, which also tells
us whether there was an error in trying to parse a type-name (type-id
in C++). This allows propagation of errors further in the compiler,
suppressing more bogus error messages.
Ted Kremenek [Wed, 18 Feb 2009 17:42:44 +0000 (17:42 +0000)]
Revise comment. Comparing pointer values in 'Range' wasn't the performance issue I thought it was, but it is still worth ordering Range objects by their APSInt values.
Chris Lattner [Wed, 18 Feb 2009 05:49:11 +0000 (05:49 +0000)]
change the StringLiteral AST node to track all of the SourceLocations of
the various PPTokens that are pasted together to make it. In the course
of working on this, I discovered ParseObjCStringLiteral which needs some
work. I'll tackle it next.
Ted Kremenek [Wed, 18 Feb 2009 05:22:01 +0000 (05:22 +0000)]
Fix performance bug in RangeConstraintManager (that I introduced):
When comparing if one Range is "less" than another, compare the actual APSInt
numeric values instead of their pointer addresses. This ensures that the
ImmutableSet in RangeSet always has a consistent ordering between Ranges. This
is critical for generating the same digest/hash for the contents of the sets.
This was a serious performance bug because it would often cause state caching
to be disabled along complicated paths.
Along the way:
- Put Range and RangeSet in the "anonymous namespace" and mark them hidden
Representation of objc gc's attribute using ExtQualType.
Note that one test attr-objc-gc.m fails. I will fix this
after removing these attributes from the Decl nodes.
Chris Lattner [Wed, 18 Feb 2009 04:02:00 +0000 (04:02 +0000)]
Optimize dyld startup time by specifying a trivial export map
(only export main) on the mac.
This improves DYLD_PRINT_STATISTICS from:
total time: 6.0 milliseconds (100.0%)
total images loaded: 5 (4 from dyld shared cache, 3 needed no fixups)
total segments mapped: 0, into 0 pages with 0 pages pre-fetched
total images loading time: 0.0 milliseconds (1.4%)
total rebase fixups: 0
total rebase fixups time: 0.0 milliseconds (0.0%)
total binding fixups: 7,928
total binding symbol lookups: 4,087, average images searched per symbol: 1.9
total binding fixups time: 4.7 milliseconds (79.2%)
total bindings lazily fixed up: 170 of 4,372
total init time time: 1.1 milliseconds (19.2%)
total images with weak exports: 2
to:
total time: 1.4 milliseconds (100.0%)
total images loaded: 5 (4 from dyld shared cache, 4 needed no fixups)
total segments mapped: 0, into 0 pages with 0 pages pre-fetched
total images loading time: 0.0 milliseconds (5.7%)
total rebase fixups: 0
total rebase fixups time: 0.0 milliseconds (0.2%)
total binding fixups: 1,079
total binding symbol lookups: 75, average images searched per symbol: 1.0
total binding fixups time: 0.5 milliseconds (33.9%)
total bindings lazily fixed up: 14 of 216
total init time time: 0.8 milliseconds (60.0%)
total images with weak exports: 1
This reduces the time to -fsyntax-only cocoa.h with PTH from 0.192s to 0.184 (4.3%)
Ted Kremenek [Wed, 18 Feb 2009 03:48:14 +0000 (03:48 +0000)]
Hooked up the necessary machinery to allow the retain/release checker reference
back to the summary used when evaluating the statement associated with a
simulation node. This is now being used to help improve the checker's
diagnostics. To get things started, the checker now emits a path diagnostic
indicating that 'autorelease' is a no-op in GC mode.
Some of these changes are exposing further grossness in the interface between
BugReporter and the ExplodedGraph::Trim facilities. These really need to be
cleaned up one day.
Eli Friedman [Wed, 18 Feb 2009 01:02:14 +0000 (01:02 +0000)]
Fix test: config.h is not guaranteed to exist at the location in
question. Use __builtin_alloca instead, which is guaranteed to mean the right
thing without any includes.
Daniel Dunbar [Wed, 18 Feb 2009 00:32:53 +0000 (00:32 +0000)]
Convert isIntegerConstantExpr to use ASTContext::MakeIntValue.
- This idiom ensures that the result will have the right width and
type.
- Tested on most of x86_64/llvm-test to satisfy my paranoia.
- This fixes at least the following bugs:
o UnaryTypeTraitExpr wasn't setting the width correctly.
o Arithmetic on _Bool wasn't setting the width correctly.
Daniel Dunbar [Wed, 18 Feb 2009 00:29:14 +0000 (00:29 +0000)]
Add ASTContext::MakeIntValue
- Makes an APSInt given a uint64_t and a type, with the appropriate
width and signedness to match the type. Yay for functional over
imperative.
Chris Lattner [Wed, 18 Feb 2009 00:25:15 +0000 (00:25 +0000)]
stop searching GCC install directories for standard C headers (but
keep searching for C++ headers when in C++ mode). In theory clang
should be able to find all of its own headers now. If not, the
CPATH or C_INCLUDE_PATH environment variables can be specified to
add a include path.
Douglas Gregor [Tue, 17 Feb 2009 23:15:12 +0000 (23:15 +0000)]
Implement basic parsing and semantic analysis for explicit
specialization of class templates, e.g.,
template<typename T> class X;
template<> class X<int> { /* blah */ };
Each specialization is a different *Decl node (naturally), and can
have different members. We keep track of forward declarations and
definitions as for other class/struct/union types.
This is only the basic framework: we still have to deal with checking
the template headers properly, improving recovery when there are
failures, handling nested name specifiers, etc.
Daniel Dunbar [Tue, 17 Feb 2009 22:16:19 +0000 (22:16 +0000)]
Eek! getDeclAlign sometimes returned alignment in bits.
- Renamed to getDeclAlignInBytes since most other query functions
work in bits.
- Fun to track down as isIntegerConstantExpr was getting it right,
but Evaluate() was getting it wrong. Maybe we should assert they
compute the same thing when they succeed?