Benjamin Kramer [Tue, 1 Mar 2011 22:50:47 +0000 (22:50 +0000)]
Since getDriver().getInstalledDir() returns a const char *, don't try to
compare it with getDriver().Dir.c_str(), since that is a pointer
comparison, not a "are these strings equal" comparison.
Instead, just compare with getDriver().Dir directly, so both sides will
get promoted to std::string, and the regular std::string comparison
operator applies.
Douglas Gregor [Tue, 1 Mar 2011 20:11:18 +0000 (20:11 +0000)]
Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.
Douglas Gregor [Tue, 1 Mar 2011 18:12:44 +0000 (18:12 +0000)]
Reinstate the introduction of source-location information for
nested-name-speciciers within elaborated type names, e.g.,
enum clang::NestedNameSpecifier::SpecifierKind
Fixes in this iteration include:
(1) Compute the type-source range properly for a dependent template
specialization type that starts with "template template-id ::", as
in a member access expression
dep->template f<T>::f()
This is a latent bug I triggered with this change (because now we're
checking the computed source ranges for dependent template
specialization types). But the real problem was...
(2) Make sure to set the qualifier range on a dependent template
specialization type appropriately. This will go away once we push
nested-name-specifier locations into dependent template
specialization types, but it was the source of the
valgrind errors on the buildbots.
Roman Divacky [Tue, 1 Mar 2011 18:03:28 +0000 (18:03 +0000)]
On FreeBSD, we don't want 'getDriver().Dir + "/../lib"' added to the
ToolChain's FilePaths. If clang is installed as a port in /usr/local,
it is *not* supposed to use /usr/local/lib by default, for example.
Additionally, there are no clang-related executables in either
/usr/libexec, or getDriver().Dir + "/../libexec", anymore, so remove
that from the ToolChain's ProgramPaths.
objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic -
`id objc_msgSend(id, SEL, ...)`.
But all method calls should use a prototype that matches the method,
not the prototype for objc_msgSend itself().
// rdar://9048030
Douglas Gregor [Tue, 1 Mar 2011 17:04:42 +0000 (17:04 +0000)]
When digging into a cv-qualified return type that is a pointer type to
diagnose ignored qualifiers on return types, only assume that there is
a pointer chunk if the type is *structurally* a pointer type, not if
it's a typedef of a pointer type. Fixes PR9328/<rdar://problem/9055428>.
Douglas Gregor [Tue, 1 Mar 2011 16:44:30 +0000 (16:44 +0000)]
When building a type for a typename specifier, check specifically for
a dependent template name rather than (indirectly and incorrectly)
trying to determine whether we can compute a context for the
nested-name-specifier. Fixes a GCC testsuite regression,
<rdar://problem/9068589>.
Douglas Gregor [Tue, 1 Mar 2011 16:31:39 +0000 (16:31 +0000)]
Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.
The commit message from r126737:
Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".
Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.
With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.
Move the bool-conversions behind the DiagRuntimeBehavior logic. It's
possible for these to show up due to metaprogramming both in unevaluated
contexts and compile-time dead branches.
Douglas Gregor [Tue, 1 Mar 2011 03:11:17 +0000 (03:11 +0000)]
Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".
Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.
With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.
Douglas Gregor [Tue, 1 Mar 2011 01:34:45 +0000 (01:34 +0000)]
Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.
Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.
Chris Lattner [Tue, 1 Mar 2011 00:03:48 +0000 (00:03 +0000)]
-fwrapv should turn off the inbounds markers from geps used for pointer
arithmetic. This is part of PR9256, it would be great if someone else
wired up -fno-strict-overflow in the driver to -fwrapv.
Douglas Gregor [Mon, 28 Feb 2011 23:58:31 +0000 (23:58 +0000)]
Refactor the construction of nested-name-specifiers with
source-location information into a NestedNameSpecifierLocBuilder
class, which lives within the AST library and centralize all knowledge
of the format of nested-name-specifier location information here.
Rafael Espindola [Mon, 28 Feb 2011 23:29:45 +0000 (23:29 +0000)]
Don't warn about "clang -use-gold-plugin -c ...". With this users can say
CC="clang -use-gold-plugin" CFLAGS=-emit-llvm ../configure...
and not be hit with a warning for each .c file.
Douglas Gregor [Mon, 28 Feb 2011 22:42:13 +0000 (22:42 +0000)]
Teach Sema::CheckTypenameType to use nested-name-specifiers with
source-location information. We don't actually preserve this
information in any of the resulting TypeLocs (yet), so it doesn't
matter.
Douglas Gregor [Mon, 28 Feb 2011 20:01:57 +0000 (20:01 +0000)]
Push nested-name-specifier source location information into
UnresolvedLookupExpr and UnresolvedMemberExpr.
Also, improve the computation that checks whether the base of a member
expression (either unresolved or dependent-scoped) is implicit. The
previous check didn't cover all of the cases we use in our
representation, which threw off source-location information for these
expressions (which, in turn, caused some breakage in libclang's token
annotation).
objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic -
`id objc_msgSend(id, SEL, ...)`.
But all method calls should use a prototype that matches the method,
not the prototype for objc_msgSend itself().
// rdar://9048030
Douglas Gregor [Mon, 28 Feb 2011 18:50:33 +0000 (18:50 +0000)]
Push nested-name-specifier source location information into
CXXDependentScopeMemberExpr, and clean up instantiation of
nested-name-specifiers with dependent template specialization types in
the process.
[analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.
They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that
DereferenceChecker can dispatch.
ImplicitNullDerefEvent is when we dereferenced a location that may be null.
[analyzer] Introduce "event" mechanism in CheckerManager.
A checker can register as receiver/listener of "events" (basically it registers a callback
with a function getting called with an argument of the event type) and other checkers can
register as "dispatchers" and can pass an event object to all the listeners.
This allows cooperation amongst checkers but with very loose coupling.
Douglas Gregor [Mon, 28 Feb 2011 17:23:35 +0000 (17:23 +0000)]
Eliminate the last remains of TemplateSpecializationTypes with
dependent template names. There is still a lot of redundant code in
TreeTransform to cope with TemplateSpecializationTypes, which I'll
remove in stages.
David Chisnall [Mon, 28 Feb 2011 17:11:43 +0000 (17:11 +0000)]
Make -fobjc-nonfragile-abi and -fgnu-runtime imply -fblocks (unless -fno-blocks is specified), because this combination of flags defines an Objective-C runtime that includes a blocks runtime.
Axel Naumann [Mon, 28 Feb 2011 11:22:50 +0000 (11:22 +0000)]
From Vassil Vassilev:
* Add default implementations (no-op) for ExternalASTSource's pure virtual functions. There are valid use cases that can live with these defaults.
* Move ExternalASTSource's out of line implementations into separate source file.
* Whitespace, forward decl, #include cleanup.
Chandler Carruth [Mon, 28 Feb 2011 07:25:18 +0000 (07:25 +0000)]
Fix a tiny goof in the Driver's logic which caused the explicit presence
of -fexceptions to disably C++ exceptions. The correct code was in the
ObjC branch, this just mirrors that logic on the C++ side of things.
Thanks to John Wiegley for pointing this out.
The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.
Anders Carlsson [Mon, 28 Feb 2011 02:27:16 +0000 (02:27 +0000)]
Add a -fcxx-exceptions flag to the frontend, which can be used to enable
C++ exceptions, even when exceptions have been turned off using -fno-exceptions.
Make the -fobjc-exceptions flag do the same thing, but for Objective-C exceptions.
C++ and Objective-C exceptions can also be disabled using -fno-cxx-excptions and
-fno-objc-exceptions.
Ken Dyck [Mon, 28 Feb 2011 02:01:38 +0000 (02:01 +0000)]
Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.
Chris Lattner [Mon, 28 Feb 2011 01:02:29 +0000 (01:02 +0000)]
make switch condition constant folding much more aggressive, handling
compound statements and break statements. This implements enough to
handle PR9322 and rdar://6970405.