Commit Graph

16879 Commits

Author SHA1 Message Date
Sebastian Redl 1054faed32 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.
llvm-svn: 85055
2009-10-25 17:03:50 +00:00
Sebastian Redl c45c03c9dd Ignore dependent bases in ADL. Fixes PR5271.
llvm-svn: 85054
2009-10-25 09:35:33 +00:00
Nate Begeman e46ee9aaea Add support for vector shifts, pretty straight forward.
llvm-svn: 85033
2009-10-25 02:26:48 +00:00
Nate Begeman b8326be4d9 Fix a bug in calculating shufflevector indices when constructing vectors from other vectors.
If I can find it again, I will check in a testcase.

llvm-svn: 85032
2009-10-25 02:26:01 +00:00
Daniel Dunbar 841fa8e289 Fix cmake failure trying to get SVN info for non-SVN trees.
llvm-svn: 85015
2009-10-24 20:32:58 +00:00
Sanjiv Gupta 84f0f776e9 Add a preprocessor define for adding a "near" section attribute for allowing
objects to be placed at shared memory.

llvm-svn: 85007
2009-10-24 18:08:20 +00:00
Benjamin Kramer 3f81d655d7 Remove duplicated constructor declaration.
llvm-svn: 84997
2009-10-24 10:09:11 +00:00
Benjamin Kramer 1402ce3e42 Switch alloca/sprintf to SmallString/raw_ostream.
llvm-svn: 84996
2009-10-24 09:57:09 +00:00
John McCall 703a3f8a7b Preserve type source information in TypedefDecls. Preserve it across
template instantiation.  Preserve it through PCH.  Show it off to the indexer.

I'm healthily ignoring the vector type cases because we don't have a sensible
TypeLoc implementation for them anyway.

llvm-svn: 84994
2009-10-24 08:00:42 +00:00
Douglas Gregor d33198420d Fix overload resolution when calling a member template or taking the
address of a member template when explicit template arguments are
provided.

llvm-svn: 84991
2009-10-24 04:59:53 +00:00
Fariborz Jahanian aa9894c583 Make the local buffer overflow safe.
llvm-svn: 84981
2009-10-24 00:16:42 +00:00
Fariborz Jahanian 205baf61c4 Fixe a buffer overflow problem which causes a crash
in a certain project. Need to have a permananent fix later
(FIXME added).

llvm-svn: 84980
2009-10-23 23:55:43 +00:00
Douglas Gregor 6b815c8799 Implement template instantiation for non-type template
parameters. Fixes PR5103.

llvm-svn: 84979
2009-10-23 23:25:44 +00:00
John McCall 48f2d5860d 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.

llvm-svn: 84976
2009-10-23 23:03:21 +00:00
Douglas Gregor 091f04256a 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.

llvm-svn: 84974
2009-10-23 22:18:25 +00:00
Sebastian Redl e2530ec0c0 Correct a comment.
llvm-svn: 84973
2009-10-23 22:13:42 +00:00
John McCall 856bbea332 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.

llvm-svn: 84971
2009-10-23 21:48:59 +00:00
John McCall 3665e00c87 Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.

llvm-svn: 84970
2009-10-23 21:14:09 +00:00
Fariborz Jahanian 9a14b84ac5 Diagnose misuse of '.*' and '->*' operators during parse
instead of crashing in code gen.

llvm-svn: 84968
2009-10-23 21:01:39 +00:00
Sebastian Redl f212a92bb6 Fix operator precedence in Doug's most recent commit.
llvm-svn: 84964
2009-10-23 19:38:17 +00:00
Sebastian Redl c057f423a0 Apply the special enum restrictions from [over.match.oper]p3b2 in argument-dependent lookup too. This fixes PR5244.
llvm-svn: 84963
2009-10-23 19:23:15 +00:00
Douglas Gregor 4bd90e53c2 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.

llvm-svn: 84962
2009-10-23 18:54:35 +00:00
Fariborz Jahanian c9af8fd76b Fixed a code gen bug (by fixing the AST) involving user-defined
pointer-to-member type conversion follwed by a pointer-to-member
standard conversion.

llvm-svn: 84955
2009-10-23 18:08:22 +00:00
John McCall 24e7cb6f26 Rebuild dependently-sized ext vectors if either the element type or the size
changed under the transform.

llvm-svn: 84953
2009-10-23 17:55:45 +00:00
Benjamin Kramer 0c78c7aa20 Silence GCC 4.3 warning.
TreeTransform.h:2333: warning: suggest parentheses around && within ||

llvm-svn: 84949
2009-10-23 10:48:09 +00:00
John McCall 6fd4c23324 Emit calls using the canonical prototype of the called function.
llvm-svn: 84947
2009-10-23 08:22:42 +00:00
Ted Kremenek ca42a51dce Add comment.
llvm-svn: 84930
2009-10-23 04:45:31 +00:00
Ted Kremenek 49c5232d9f 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.

This fixes: <rdar://problem/7328900>

llvm-svn: 84925
2009-10-23 03:57:22 +00:00
John Thompson d73d7add37 Fixed undefined behavior in pushMappings when the stack has to resize.
llvm-svn: 84924
2009-10-23 02:21:17 +00:00
Mike Stump 9bb0059449 Add radar number.
llvm-svn: 84923
2009-10-23 02:13:20 +00:00
Mike Stump ae2559a221 Fixup the return type of functions.
llvm-svn: 84922
2009-10-23 01:52:13 +00:00
John McCall e634700c81 FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash if
one was PCH'ed without any.

llvm-svn: 84920
2009-10-23 01:28:53 +00:00
John McCall 90459c50d7 Preserve type source information when substituting into FieldDecls.
Just r84734 now that some fundamental work has been completed.

llvm-svn: 84914
2009-10-22 23:33:21 +00:00
John McCall fa2d692b7d Preserve source information for anonymous struct/union declarations.
llvm-svn: 84913
2009-10-22 23:31:08 +00:00
Fariborz Jahanian ffba662dd2 Complete code gen for '.*' binary expression for
both scalar and aggregates.

llvm-svn: 84910
2009-10-22 22:57:31 +00:00
Fariborz Jahanian 0797404a33 Fixes a warning.
llvm-svn: 84909
2009-10-22 22:49:47 +00:00
John McCall fc93cf9777 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.

llvm-svn: 84907
2009-10-22 22:37:11 +00:00
Ted Kremenek 2a3ffa9658 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.
llvm-svn: 84904
2009-10-22 22:19:00 +00:00
John Thompson 69b4b14f52 Disable Microsoft extensions to fix failure on Windows.
llvm-svn: 84893
2009-10-22 20:34:27 +00:00
John McCall b692a098c6 Canonicality is a property of qualified types, not unqualified types.
llvm-svn: 84891
2009-10-22 20:10:53 +00:00
Chris Lattner c78b8f3c3a fix #2 :)
llvm-svn: 84889
2009-10-22 19:56:49 +00:00
Chris Lattner 7b53668b8f fix testcase, thanks Daniel.
llvm-svn: 84888
2009-10-22 19:56:26 +00:00
Douglas Gregor 6a573fe543 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...
llvm-svn: 84880
2009-10-22 18:02:20 +00:00
Ted Kremenek a96b72a4ca Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
llvm-svn: 84873
2009-10-22 17:22:53 +00:00
Douglas Gregor d019ff686c 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.

llvm-svn: 84869
2009-10-22 17:20:55 +00:00
Daniel Dunbar cb8eb225b1 Update test; the driver can find a different gcc tool chain directory when
simulating running on a different system.

llvm-svn: 84862
2009-10-22 16:05:11 +00:00
Sebastian Redl 802f14ccde Try to instantiate templates before doing hierarchy checks in static_cast. Fixes PR5261.
llvm-svn: 84860
2009-10-22 15:07:22 +00:00
Douglas Gregor 3c8a0cfa5b When a template-id expression refers to a member function template, turn it into an (implicit) member access expression. Fixes PR5220
llvm-svn: 84848
2009-10-22 07:19:14 +00:00
Douglas Gregor 6493d9c27e Refactor our handling of implicit member reference expressions to get most of the logic out of BuildDeclarationNameExpr
llvm-svn: 84847
2009-10-22 07:08:30 +00:00
Chris Lattner 63d2b3615c fix PR5265: the size of a float3 should be rounded up to its alignment.
This ensures that arrays of float3 are correctly padded.

llvm-svn: 84833
2009-10-22 05:17:15 +00:00