Daniel Dunbar [Sun, 24 Jan 2010 02:02:07 +0000 (02:02 +0000)]
Initial checkin of CIndex Python bindings, by Andrew Sutton!
- Some tweaks by me for API changes, Darwin, and x86_64 support. Still needs
substantial updating to match recent CIndex API changes.
Chris Lattner [Sun, 24 Jan 2010 01:30:04 +0000 (01:30 +0000)]
add a prototype for __builtin_fpclassify. We don't know how to
codegen it, so we get 'cannot compile this builtin function yet'
errors, just like we do currently for __builtin_isinf. However,
this should let us parse headers that use it without barfing,
which should help PR6083.
Anders Carlsson [Sun, 24 Jan 2010 00:19:41 +0000 (00:19 +0000)]
Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.
Mike Stump [Sat, 23 Jan 2010 20:23:40 +0000 (20:23 +0000)]
Temporary flip default for -Wunreachable-code so some bots can test it
out. They should all be done later tonight, but if something bad
happens, feel free to revert sooner.
Anders Carlsson [Sat, 23 Jan 2010 19:55:29 +0000 (19:55 +0000)]
Baby steps towards migrating the InitListChecker over to the new initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++.
John McCall [Sat, 23 Jan 2010 08:10:49 +0000 (08:10 +0000)]
Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).
The causes of this problem are different enough to justify a different "design"
for the diagnostic. Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.
This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.
Anders Carlsson [Sat, 23 Jan 2010 05:47:27 +0000 (05:47 +0000)]
Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)
John McCall [Sat, 23 Jan 2010 05:17:32 +0000 (05:17 +0000)]
During overload resolution diagnostics, sort non-viable candidates by the quality of their
conversions. To make this work, fill out all conversions for all candidates
(but only when diagnosing overload failure). Split out a few cases from
ovl_fail_bad_conversion which didn't actually involve a failed argument
conversion.
I'm pretty sure this is not a well-founded ordering, but I'm not sure it matters.
Anders Carlsson [Sat, 23 Jan 2010 04:34:47 +0000 (04:34 +0000)]
Separate EK_ArrayOrVectorElement into EK_ArrayElement and EK_VectorElement; arrays and vectors are pretty different beasts in C++. Doug, please review/comment.
Ted Kremenek [Fri, 22 Jan 2010 22:12:47 +0000 (22:12 +0000)]
(1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
agnostic).
(2) Add getClangFullRepositoryVersion(), which contains an
amalgamation of the repository name and the revision.
(3) Change PCH to only emit the string returned by
getClangFullRepositoryVersion() instead of also emitting the value
of getClangSubversionRevision() (which has been removed). This is
functionally equivalent.
More cleanup to version string generation pending...
Douglas Gregor [Fri, 22 Jan 2010 21:44:22 +0000 (21:44 +0000)]
Yet more CIndex API cleanup:
- Added more routines to manipulate/compare source locations and ranges
- Switched clang_getCursor() over to take a CXSourceLocation rather
than file/line/column.
Mike Stump [Fri, 22 Jan 2010 20:27:17 +0000 (20:27 +0000)]
Be sure to select primary bases among the nearly empties in preorder,
not just among the direct bases. Before we where missing nearly
empties that were bases of virtual base classes.
Douglas Gregor [Fri, 22 Jan 2010 19:49:59 +0000 (19:49 +0000)]
Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.
Minor other tweaks needed to make this work:
- Extend Preprocessor::getLocForEndOfToken() to accept an offset
from the end, making it easy to move to the last character in the
token (rather than just past the end of the token).
- In Lexer::MeasureTokenLength(), the length of whitespace is zero.
Anders Carlsson [Fri, 22 Jan 2010 17:37:20 +0000 (17:37 +0000)]
No need to canonicalize the type and use dyn_cast. Also, correctly diagnose trying to override a function returning an lvalue reference with a function overriding an rvalue reference.
Daniel Dunbar [Fri, 22 Jan 2010 03:38:14 +0000 (03:38 +0000)]
Driver/Darwin: Update tool chain to use static clang_rt libraries provided by
compiler-rt. This tool chain now works on x86 and ARM, but isn't the x86 default
yet.
This drastically cleans up the linker invocation, old invocation:
--
"/Developer/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.6.0" "-weak_reference_mismatches" "non-weak" "-o" "a.out" "-lcrt1.10.6.o" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64" "-L/usr/lib/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1" "-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.." "t.o" "-lSystem" "-lgcc"
--
Douglas Gregor [Fri, 22 Jan 2010 00:50:27 +0000 (00:50 +0000)]
Teach the cursor visitor to walk all of the C and Objective-C
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.
John McCall [Fri, 22 Jan 2010 00:28:27 +0000 (00:28 +0000)]
Create function, block, and template parameters in the context of the
translation unit. This is temporary for function and block parameters;
template parameters can just stay this way, since Templates aren't
DeclContexts. This gives us the nice property that everything created
in a record DC should have access in C++.
Chris Lattner [Fri, 22 Jan 2010 00:14:44 +0000 (00:14 +0000)]
revert my patch for rdar://7520940 that warns when a published header
is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.
Douglas Gregor [Thu, 21 Jan 2010 20:48:56 +0000 (20:48 +0000)]
Teach the cursor visitor to walk into typeof types (both kinds). This
is hard to test now; tests will come when we can walk stataements and
expressions properly.
Ted Kremenek [Thu, 21 Jan 2010 19:22:34 +0000 (19:22 +0000)]
Allocate the 'Protocols' array in ObjCInterfaceType and
ObjCObjectPointerType using the allocator associated with ASTContext.
Not only does this fix a memory leak, but it also makes these arrays
BumpPtrAllocated (in the typical case).
Daniel Dunbar [Thu, 21 Jan 2010 17:10:39 +0000 (17:10 +0000)]
Add a test for clang_rt support on Darwin. With appropriate massaging, this
checks that the runtime library can be linked and works for compiling on 10.6
for 10.{4,5,6} targets. Currently test is only for x86, and misses some
compiler-rt functions.
Mike Stump [Thu, 21 Jan 2010 15:20:48 +0000 (15:20 +0000)]
Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls. Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.
This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges. All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.