Douglas Gregor [Wed, 21 Oct 2009 22:01:30 +0000 (22:01 +0000)]
Don't generate pointer types for void or base classes when finding
conversion types for builtin overloaded operator candidates; I misread
this section in the standard the first time around.
Douglas Gregor [Wed, 21 Oct 2009 15:46:01 +0000 (15:46 +0000)]
Downgrade "function declared 'noreturn' should not return" from an
error (by default) to a warning, per C++0x [dcl.attr.noreturn]. Patch
from Sean Hunt!
Steve Naroff [Wed, 21 Oct 2009 13:56:23 +0000 (13:56 +0000)]
Extend clang_getCursor() to take a 'relativeDecl' argument (so speed up searching). Without a 'relativeDecl', the algorithm is n-squared. For example, running the following command on 'Large.m' takes hours without a 'relatvieDecl'.
snaroff% time ../../Debug/bin/c-index-test Large.ast all > Large.out
snaroff% cat Large.m
#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>
#import <OpenGL/OpenGL.h>
Mike Stump [Wed, 21 Oct 2009 03:49:08 +0000 (03:49 +0000)]
Prep work to always preallocate BlockDeclRefExprs so that we can
generate the debug information for the first parameter to the block
invoke functions. WIP.
Anders Carlsson [Tue, 20 Oct 2009 22:53:47 +0000 (22:53 +0000)]
Change ResolveAddressOfOverloadedFunction to support TemplateIdRefExpr. No testcase yet because FixOverloadedFunctionReference needs to be updated too. Doug, plz review.
Ted Kremenek [Tue, 20 Oct 2009 21:39:41 +0000 (21:39 +0000)]
Add destructor and cleanup code to LocationContext (fixing some leaks). Along the way, have
AnalysisManager periodically cleanup its AnalysisContextManager and LocationContextManager objects,
as they don't need to forever retain all the CFGs ever created when analyzing a file.
Changed text of warning in my last patch.
Related to radar:
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions
Issue warning if method body starts with a semicolon.
Fixes
<rdar://problem/7308503> clang should disallow the trailing semicolon in method definitions
Steve Naroff [Tue, 20 Oct 2009 14:46:24 +0000 (14:46 +0000)]
- Extend clang_createIndex() to support PCH and diagnostic 'filtering'. This seems cleaner to me without sacrificing much flexibility.
- Remove clang_wantOnlyLocalDeclarations().
- Remove 'displayDiagnostics' arguments to clang_createTranslationUnitFromSourceFile() and clang_createTranslationUnit().
- Have clang_createTranslationUnitFromSourceFile() strip the '-o <outfile>' command line arguments if they exist. Document this semantic in the header. Also verify we have a valid ASTUnit before telling it to 'unlinkTemporaryFile()'.
Eli Friedman [Tue, 20 Oct 2009 08:27:19 +0000 (08:27 +0000)]
Remove default argument for ImpCastExprToType. Add appropriate argument
to all callers. Switch a few other users of CK_Unknown to proper cast
kinds.
Note that there are still some situations where we end up with
CK_Unknown; they're pretty easy to find with grep. There
are still a few missing conversion kinds, specifically
pointer/int/float->bool and the various combinations of real/complex
float/int->real/complex float/int.
Ted Kremenek [Tue, 20 Oct 2009 06:31:34 +0000 (06:31 +0000)]
Call 'clear()' in ~RopePieceBTreeLeaf(), decrementing the reference
counts of the bufffers referened by the RopePieces in
RopePieceBTreeLeaf. This (I believe) corrently fixes the leak I meant
to fix in r84601 (which ended up causing an overrelease).
Douglas Gregor [Tue, 20 Oct 2009 05:58:46 +0000 (05:58 +0000)]
Handle substitutions into the "first qualifier in scope" of a
qualified member access expression (e.g., t->U::member) when that
first qualifier refers to a template parameters.
Ted Kremenek [Tue, 20 Oct 2009 05:49:17 +0000 (05:49 +0000)]
BumpVectorContext: Use 'unsigned' integer type with PointerIntUnion instead of bool to keep it clear that we are reasoning about an unsigned integer with a single bit.
Chris Lattner [Tue, 20 Oct 2009 05:36:05 +0000 (05:36 +0000)]
Implement PR5242: don't desugar a type more than once in a diagnostic. This
implements a framework that allows us to use information about previously
substituted values to simplify subsequent ones. Maybe this would be useful
for C++'y stuff, who knows. We now get:
t.c:4:21: error: invalid operands to binary expression ('size_t' (aka 'unsigned long *') and 'size_t')
return (size_t) 0 + (size_t) 0;
~~~~~~~~~~ ^ ~~~~~~~~~~
on the testcase. Note that size_t is only aka'd once.
Chris Lattner [Tue, 20 Oct 2009 05:25:22 +0000 (05:25 +0000)]
teach FormatDiagnostic to aggregate previously formatted arguments and
pass them down into the ArgToStringFn implementation. This allows
redundancy across operands to a diagnostic to be eliminated.
Ted Kremenek [Tue, 20 Oct 2009 05:25:11 +0000 (05:25 +0000)]
Fix a reference count imbalance in RewriteRope::MakeRopeString().
This was causing a ton of memory to be leaked when using HTML
diagnostics with the static analyzer (on large files with many errors).
Mike Stump [Tue, 20 Oct 2009 02:12:22 +0000 (02:12 +0000)]
Refine the type of the first parameter to block invoke functions.
WIP. I have yet to find the magic incantation to get the structure
type to be defined. If someone has a pointer, love to hear it.
Ted Kremenek [Mon, 19 Oct 2009 22:15:09 +0000 (22:15 +0000)]
Really fix <rdar://problem/7312058> by adding a 'displayDiagnostics' option to
clang_createTranslationUnit() and clang_createTranslationUnitFromSourceFile(). The user can now
specify if the diagnostics from Clang are printed to stderr or are silenced completely. We can
obviously evolve this API to be more general in the future.
Note: Added a FIXME since I wasn't certain what was the best way to redirect to something analogous
to '/dev/null' on Windows.
Ted Kremenek [Mon, 19 Oct 2009 21:44:57 +0000 (21:44 +0000)]
The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ASTUnit to specify
alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding
DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object
is destroyed.
The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences
diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes
<rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients.
Ted Kremenek [Mon, 19 Oct 2009 21:17:25 +0000 (21:17 +0000)]
Re-order includes so that the logic involving '#ifdef LLVM_ON_WIN32' appears after the main #includes. The ultimate solution is to just use LLVM-portable methods in llvm/System.
Steve Naroff [Mon, 19 Oct 2009 14:34:22 +0000 (14:34 +0000)]
Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.
Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>).
Daniel Dunbar [Mon, 19 Oct 2009 09:11:21 +0000 (09:11 +0000)]
Workaround a bug exposed by the FileCheckify of message-length.c, the caret end
column computation isn't correct and could exceed the line length, which
resulted in a buffer overflow later.
- Chris, is there a better way for this code to compute the final column used
by the caret?
Daniel Dunbar [Mon, 19 Oct 2009 01:21:12 +0000 (01:21 +0000)]
Update NamedDecl::getName() to work for empty names.
- I'm not sure this is ideal, but otherwise clients must be overly careful when handling decl's which can have empty names.
Anders Carlsson [Sun, 18 Oct 2009 23:09:21 +0000 (23:09 +0000)]
When binding a reference to a temporary, it's important that other temporaries created as on the RHS are destroyed before emitting the dtor for the temporary.