Daniel Dunbar [Sun, 25 Oct 2009 20:34:02 +0000 (20:34 +0000)]
Tweak test, with -strict-whitespace $ won't match on Windows because the buffer
will have \r\n.
- Perhaps we should make FileCheck normalize line-endings, even in
strict-whitespace mode?
Chris Lattner [Sun, 25 Oct 2009 18:21:37 +0000 (18:21 +0000)]
simplify interface to ConvertDeclSpecToType, check for inferred
block return types only when a TST isn't specified, not every time
through GetTypeForDeclarator.
Chris Lattner [Sun, 25 Oct 2009 17:47:27 +0000 (17:47 +0000)]
change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead
of ConvertDeclSpecToType, which I'd like to keep private to SemaType.cpp.
We do this by cons'ing up a trivial Declarator for the type.
Chris Lattner [Sun, 25 Oct 2009 17:16:46 +0000 (17:16 +0000)]
simplify Sema::getTypeName a bit: if control gets out of the switch,
IIDecl cannot be null. There is no need to check for both C++ mode and
presence of CXXRecordDecl. ObjC interfaces can't have ScopeSpecs.
Chris Lattner [Sun, 25 Oct 2009 17:04:48 +0000 (17:04 +0000)]
In objc mode, every identifier in a cast expression was using doing a
type looking using getTypeName() and every property access was using
NextToken() to do lookahead to see if the identifier is followed by
a '.'. Rearrange this code to not need lookahead and only do the
type lookup if we have "identifier." in the token stream. Also
improve a diagnostic a bit.
Sebastian Redl [Sun, 25 Oct 2009 17:03:50 +0000 (17:03 +0000)]
Audit the code for places where it is assumed that every base specifier refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector.
John McCall [Fri, 23 Oct 2009 23:03:21 +0000 (23:03 +0000)]
Store the builtin types as CanQualTypes. Expand a bit on the CanQual API,
but also remove some methods that cause ambiguities, and generally
make CanQual<blah> more analogous to QualType.
Douglas Gregor [Fri, 23 Oct 2009 22:18:25 +0000 (22:18 +0000)]
Migrate Sema::ActOnCallExpr to Sema::FixOverloadedFunctionReference,
so that we maintain better source information after template argument
deduction and overloading resolves down to a specific
declaration. Found and dealt with a few more cases that
FixOverloadedFunctionReference didn't cope with.
(Finally) added a test case that puts together this change with the
DeclRefExpr change to (optionally) include nested-name-specifiers and
explicit template argument lists.
John McCall [Fri, 23 Oct 2009 21:48:59 +0000 (21:48 +0000)]
Remove OriginalTypeParmDecl; the original type is the one specified
in the DeclaratorInfo, if one is present.
Preserve source information through template instantiation. This is made
more complicated by the possibility that ParmVarDecls don't have DIs, which
is possibly worth fixing in the future.
Also preserve source information for function parameters in ObjC method
declarations.
Douglas Gregor [Fri, 23 Oct 2009 18:54:35 +0000 (18:54 +0000)]
Eliminate QualifiedDeclRefExpr, which captured the notion of a
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,
namespace N { int i; }
int j = N::i;
Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.
Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.
Ted Kremenek [Fri, 23 Oct 2009 03:57:22 +0000 (03:57 +0000)]
Fix integer overflow in PCHReader when reading the length of an
identifier. This caused a crash when reading PCH files that contained
long identifier names.
The issue is that 'StrLenPtr' was previously a 'const char *', meaning
the byte loaded from it would be interpretted as a signed integer. If
the topmost bit was set, conversion to 'unsigned' would extend that
bit, causing an overflow.
The solution is to make 'StrLenPtr' an 'unsigned char *', always
treating the value as an unsigned integer.
John McCall [Thu, 22 Oct 2009 22:37:11 +0000 (22:37 +0000)]
When building types from declarators, instead of building two types (one for
the DeclaratorInfo, one for semantic analysis), just build a single type whose
canonical type will reflect the semantic analysis (assuming the type is
well-formed, of course).
To make that work, make a few changes to the type system:
* allow the nominal pointee type of a reference type to be a (possibly sugared)
reference type. Also, preserve the original spelling of the reference type.
Both of these can be ignored on canonical reference types.
* Remove ObjCProtocolListType and preserve the associated source information on
the various ObjC TypeLocs. Preserve the spelling of protocol lists except in
the canonical form.
* Preserve some level of source type structure on parameter types, but
canonicalize on the canonical function type. This is still a WIP.
Drops code size, makes strides towards accurate source location representation,
slight (~1.7%) progression on Cocoa.h because of complexity drop.
Ted Kremenek [Thu, 22 Oct 2009 22:19:00 +0000 (22:19 +0000)]
Always emit error diagnostics when an error occurs within clang_createTranslationUnit() and clang_createTranslationUnitFromSource(). These kind of errors are ones that shouldn't be missed.
Douglas Gregor [Thu, 22 Oct 2009 18:02:20 +0000 (18:02 +0000)]
When replacing a template-id expression with a declaration reference expression after overloading completes, make sure to keep the qualifier. Still not ready with that test-case...
Douglas Gregor [Thu, 22 Oct 2009 17:20:55 +0000 (17:20 +0000)]
When building and instantiating a template-id reference expression, such as
N::f<int>
keep track of the full nested-name-specifier. This is mainly QoI and
relatively hard to test; will try to come up with a printing-based
test once we also retain the explicit template arguments past overload
resolution.
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.