Граф коммитов

15705 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 4d0d85c337 Make the local buffer overflow safe.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 00:16:42 +00:00
Fariborz Jahanian 60aeaddb12 Fixe a buffer overflow problem which causes a crash
in a certain project. Need to have a permananent fix later
(FIXME added).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 23:55:43 +00:00
Douglas Gregor 33642df300 Implement template instantiation for non-type template
parameters. Fixes PR5103.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 23:25:44 +00:00
John McCall e27ec8ad56 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84976 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 23:03:21 +00:00
Douglas Gregor 097bfb1175 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 22:18:25 +00:00
Sebastian Redl 06a59bb826 Correct a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 22:13:42 +00:00
John McCall 58e4677a94 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 21:48:59 +00:00
John McCall a4eb74d4df Add ASTContext::getTrivialDeclaratorInfo, which initializes a new
source info block with a single location.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84970 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 21:14:09 +00:00
Fariborz Jahanian f071e9b173 Diagnose misuse of '.*' and '->*' operators during parse
instead of crashing in code gen.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 21:01:39 +00:00
Sebastian Redl 2cf719c3c3 Fix operator precedence in Doug's most recent commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 19:38:17 +00:00
Sebastian Redl 644be853b8 Apply the special enum restrictions from [over.match.oper]p3b2 in argument-dependent lookup too. This fixes PR5244.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 19:23:15 +00:00
Douglas Gregor a2813cec26 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.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 18:54:35 +00:00
Fariborz Jahanian 7a1f4cc8d5 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 18:08:22 +00:00
John McCall eee91c3efb Rebuild dependently-sized ext vectors if either the element type or the size
changed under the transform.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 17:55:45 +00:00
Benjamin Kramer 38caf910aa Silence GCC 4.3 warning.
TreeTransform.h:2333: warning: suggest parentheses around && within ||


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 10:48:09 +00:00
John McCall 00a1ad9a34 Emit calls using the canonical prototype of the called function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84947 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 08:22:42 +00:00
Ted Kremenek 231bc0b7a7 Add comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 04:45:31 +00:00
Ted Kremenek ff1ea462bf 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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 03:57:22 +00:00
John Thompson ca2c3e2cfc Fixed undefined behavior in pushMappings when the stack has to resize.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 02:21:17 +00:00
Mike Stump 386378de86 Add radar number.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 02:13:20 +00:00
Mike Stump 91cc815ffd Fixup the return type of functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 01:52:13 +00:00
John McCall 86acc2a0ea FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash if
one was PCH'ed without any.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-23 01:28:53 +00:00
John McCall 07fb6bef62 Preserve type source information when substituting into FieldDecls.
Just r84734 now that some fundamental work has been completed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 23:33:21 +00:00
John McCall eb692e07c7 Preserve source information for anonymous struct/union declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 23:31:08 +00:00
Fariborz Jahanian 8bfd31f9da Complete code gen for '.*' binary expression for
both scalar and aggregates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:57:31 +00:00
Fariborz Jahanian cab9882dac Fixes a warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84909 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:49:47 +00:00
John McCall 54e14c4db7 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:37:11 +00:00
Ted Kremenek 8ee1f3fc0d 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 22:19:00 +00:00
John Thompson 79162ce8ca Disable Microsoft extensions to fix failure on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 20:34:27 +00:00
John McCall 467b27b9a2 Canonicality is a property of qualified types, not unqualified types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 20:10:53 +00:00
Chris Lattner e78ec31490 fix #2 :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 19:56:49 +00:00
Chris Lattner 4a058ded4d fix testcase, thanks Daniel.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 19:56:26 +00:00
Douglas Gregor 423a4e0c85 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...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 18:02:20 +00:00
Ted Kremenek fbcb2b716b Split clang_getCursor() into clang_getCursor() and clang_getCursorWithHint().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 17:22:53 +00:00
Douglas Gregor f17bb74e74 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 17:20:55 +00:00
Daniel Dunbar b2b517c5fb Update test; the driver can find a different gcc tool chain directory when
simulating running on a different system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 16:05:11 +00:00
Sebastian Redl 5ed66f7091 Try to instantiate templates before doing hierarchy checks in static_cast. Fixes PR5261.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 15:07:22 +00:00
Douglas Gregor a9e29aa4b1 When a template-id expression refers to a member function template, turn it into an (implicit) member access expression. Fixes PR5220
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 07:19:14 +00:00
Douglas Gregor e961afbf3f Refactor our handling of implicit member reference expressions to get most of the logic out of BuildDeclarationNameExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 07:08:30 +00:00
Chris Lattner 9fcfe92643 fix PR5265: the size of a float3 should be rounded up to its alignment.
This ensures that arrays of float3 are correctly padded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 05:17:15 +00:00
Ted Kremenek 379afec20c Add some explanatory diagnostics when clang_createTranslationUnitFromSource fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 03:24:01 +00:00
Zhongxing Xu 524e465f70 Rename: CheckBadDiv->CheckDivZero.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 01:58:10 +00:00
Mike Stump d3dd0aeb14 Remove some misguided code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 01:31:24 +00:00
Mike Stump 083c25eea1 Extend out the block descriptor structure for debug information with
the copy/dispose helpers as appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 00:49:09 +00:00
Daniel Dunbar 080fb19301 Driver: Fix thinko in logic for finding gcc's tool chain directory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 00:12:00 +00:00
Ted Kremenek 139ba86a36 Enhance 'clang_createTranslationUnitFromSourceFile()' in two ways:
(1) Allow the source file to be specified in the actual command line arguments by allowing the
    caller to set 'source_filename' to NULL.

(2) Automatically strip off the arguments '-emit-ast', '-fsyntax-only', and '-c'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 00:03:57 +00:00
Fariborz Jahanian f51dc64f90 Code gen for '.*' binary expressions - WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84800 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:45:42 +00:00
Douglas Gregor 573d9c3252 Don't (directly) call RequireCompleteType with an invalid source location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84793 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:19:44 +00:00
Mike Stump 0298d3888b Turn on the preallocation of all BlockDeclRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 22:02:08 +00:00
Douglas Gregor 652371ad04 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 22:01:30 +00:00