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

8801 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor c5df30fe34 Use Sema::getMostSpecialized to eliminate a redundant implementation of the most-specialized function template
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 03:41:46 +00:00
Anders Carlsson bb36ba488b Change isTemplate to return the actual template declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 03:24:57 +00:00
Anders Carlsson ae35248661 Improve mangling of typename types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 02:26:02 +00:00
Anders Carlsson a223935e5c Rename NextOffset to DataSize.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:34:51 +00:00
Anders Carlsson dfde681bdd Start at NextOffset when laying out bases as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:29:10 +00:00
Anders Carlsson 7e41038723 Use NextOffset when laying out a field.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:09:35 +00:00
Anders Carlsson 4f5bf3b095 Don't try to dump invalid decls or forward decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 01:02:04 +00:00
Anders Carlsson 3c31a39af9 Cast cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-26 00:12:34 +00:00
Douglas Gregor 0b60d9e009 Use explicitly-specified template argument lists to help naming
explicit template specializations, when available.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 23:53:26 +00:00
Douglas Gregor db422dffb7 Declarators can now properly represent template-ids, e.g., for
template void f<int>(int);
                ~~~~~~
Previously, we silently dropped the template arguments. With this
change, we now use the template arguments (when available) as the
explicitly-specified template arguments used to aid template argument
deduction for explicit template instantiations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 21:45:23 +00:00
Fariborz Jahanian b3c477415f Refixed pr5050 per Anders comment. Test case enhanced
per Doug's comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82791 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:59:21 +00:00
Douglas Gregor d5a423b279 WIP implementation of explicit instantiation of function templates,
member functions of class template specializations, and static data
members. The mechanics are (mostly) present, but the semantic analysis
is very weak.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:43:00 +00:00
Fariborz Jahanian 7498e50aea Fix the AST tree so ir-gen can do the conversion via copy construction.
Fixed pr5050.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:25 +00:00
Mike Stump bcdc0f0aff Fix 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:00 +00:00
Anders Carlsson 1eca99b815 Even more work on empty classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 15:39:00 +00:00
Benjamin Kramer bdbeeb50c5 Fix MSVC build by renaming a variable. PR5043
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82762 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 11:47:22 +00:00
Douglas Gregor 0ed093069a Sigh. Be *really* careful when copying a default function argument during template instantiation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 07:03:22 +00:00
Douglas Gregor f43d0b37c1 Be careful about copying uninstantiated default arguments during template instantiation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 06:56:31 +00:00
Ted Kremenek b8bb3e797c Turn on 'RegionStore' as the default store manager both for 'clang --analyze' and 'scan-build'. Leave 'BasicStore' as the default store manager in 'clang-cc'. While there are still known warts with RegionStore, it's ready to be tested by general users.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82752 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 05:55:59 +00:00
Douglas Gregor ce94049b69 Fix checking for a null pointer constant when the expression itself is
value-dependent. Audit (and fixed) all calls to
Expr::isNullPointerConstant() to provide the correct behavior with
value-dependent expressions. Fixes PR5041 and a crash in libstdc++
<locale>.

In the same vein, properly compute value- and type-dependence for
ChooseExpr. Fixes PR4996.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 04:25:58 +00:00
Anders Carlsson a4c6081abd Who would have thought that empty classes were so tricky? Handle cases where an empty virtual base class needs to be moved aside because it conflicts with the first field.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82746 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 01:54:38 +00:00
John McCall a180529e3d Fix an infinite loop arising when trying to generate debug information
for a ObjC class with an ivar of weak self type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 01:40:47 +00:00
Anders Carlsson fbbce49c11 Handle array fields that contain empty structs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 01:23:32 +00:00
Ted Kremenek 80417471b0 Fix <rdar://problem/7249327> by allowing silent conversions between signed and unsigned integer values for symbolic values. This is an intermediate solution (i.e. hack) until we support extension/truncation of symbolic integers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 00:18:15 +00:00
Anders Carlsson 6026504302 More work on empty classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 00:02:51 +00:00
Fariborz Jahanian 76368e843c Fixed another code gen bug in objc's new write-barrier API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 00:00:20 +00:00
Anders Carlsson 8fdccd95fc Improve the record layout dumper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 23:50:42 +00:00
Douglas Gregor 7dfd0fb083 When entering the scope of a declarator, make sure that the scope is
complete (or, possibly causing template instantiation).

Test this via some explicit specializations of member functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 23:39:01 +00:00
John McCall 6b304a0254 Make it really, really easy to change the alignment of Type (and ExtQuals).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82730 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 23:30:46 +00:00
Douglas Gregor b9aa6b214c WIP implementation of explicit function template specialization. This
first implementation recognizes when a function declaration is an
explicit function template specialization (based on the presence of a
template<> header), performs template argument deduction + ambiguity
resolution to determine which template is being specialized, and hooks

There are many caveats here:
  - We completely and totally drop any explicitly-specified template
  arguments on the floor
  - We don't diagnose any of the extra semantic things that we should
  diagnose. 
  - I haven't looked to see that we're getting the right linkage for
  explicit specializations

On a happy note, this silences a bunch of errors that show up in
libstdc++'s <iostream>, although Clang still can't get through the
entire header.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 23:14:47 +00:00
Mike Stump bb30419d81 Fix 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 22:31:14 +00:00
Fariborz Jahanian 6c7a1f3647 Patch fixes a code gen. bug in generation of objc_assign_ivar
(objc GC's API).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 22:25:38 +00:00
John McCall 0953e767ff Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy.  Demote 'volatile' to extended-qualifier status.  Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right;  many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 19:53:00 +00:00
Anders Carlsson 78762ebb9a Add a -dump-record-layouts argument to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 18:54:49 +00:00
Ted Kremenek 6c2497248b When building CFGs, no longer reverse the statements in the CFGBlock. Instead
have the iterators and operator[] handle the traversal of statements, as they
are stored in reverse order. Tests show this has no real performance impact, but
it does simply the CFG construction logic and will make it slightly easier to
change the allocation strategy for CFGBlocks (as we have fewer copies).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 18:45:41 +00:00
Ted Kremenek 35dcad8aee Fix crash in RegionStoreManager::Bind() by using 'getAs<PointerType>()' instead of 'cast<PointerType>()' (to handle pointer typedefs).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 06:24:32 +00:00
Anders Carlsson ffbdefc7a2 More improvements with laying out empty bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 05:21:31 +00:00
Daniel Dunbar 55e59e139d Darwin/x86-32: Enumerated types and block pointer types in structures were not
handled correctly.
 - <rdar://problem/7247671> Function arguments incorrect when function returns a
   struct on i386 w/ llvm-g++ and clang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82681 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 05:12:36 +00:00
Ted Kremenek 0954cdec4b Fix: <rdar://problem/7249340> [RegionStore] model stores to symbolic parameter regions
The issue was a discrepancy between how RegionStoreManager::Bind() and
RegionStoreManager::Retrieve() derived the "key" for the first element
of a symbolic region.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 04:11:44 +00:00
Anders Carlsson 1345bd2b09 More work on empty classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 03:22:10 +00:00
Anders Carlsson 9606149722 Scaffolding for supporting empty bases/fields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 03:13:30 +00:00
Ted Kremenek 112ba7e57e Shorten the static analyzer diagnostic for 'use of garbage value'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82672 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 00:44:26 +00:00
Fariborz Jahanian 7ad2d562e8 Use Doug's DeclLoc to pinpoint location of the declaration
in a reference initialization diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 00:42:43 +00:00
Douglas Gregor 739d828314 Improve diagnostic location information when checking the initialization of a reference
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 23:04:10 +00:00
Fariborz Jahanian 8f489d692f patch to ir-gen conversion function call used in
initializing a reference class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 22:34:00 +00:00
Douglas Gregor eb5758bbfd For code completion, note that injected-class-names found as part of
lookup in a member access expression always start a
nested-name-specifier. Additionally, rank names that start
nested-name-specifiers after other names.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 22:26:46 +00:00
Fariborz Jahanian 2b51138433 Remove the FIXME as I said.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:56:34 +00:00
Fariborz Jahanian 51bebc83e7 This patch addresses a few issues related to 8.5.3 [dcl.init.ref]
It uses a recent API to find inherited conversion functions to do
the initializer to reference lvalue conversion (and removes a FIXME).
It issues the ambiguity diagnostics when multiple conversions are found.
WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 20:55:32 +00:00
Anders Carlsson 018837b081 Handle namespace aliases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 19:19:16 +00:00
Anders Carlsson 6ac5fc49ee Emit new[] cookie when needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 18:59:48 +00:00
Anders Carlsson a4d4c019bf Basic support for new[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 16:07:23 +00:00
Douglas Gregor 5bd1a1151f When code-completion after a "," is building an overload set, note
that there is one more argument (the one following the comma) and make
the candidate non-viable if the function cannot accept any argument in
that position.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 14:56:09 +00:00
Daniel Dunbar 9fe4a5d8a6 Factor Windows target into VS, MinGW and Cygwin variants.
- Patch by John Thompson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 07:31:35 +00:00
Chris Lattner 21fb98ee00 implement support for __builtin_eh_return_data_regno on x86-32 and x86-64.
This implements PR5034 and rdar://6836445.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 06:06:36 +00:00
Anders Carlsson 569c1f4a6c Add a new variant of EmitCXXAggrConstructorCall that takes a Value that holds the number of elements to construct, to be used when implementing new[].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 02:45:36 +00:00
Ted Kremenek 657406dd40 Fix PR 4988 by removing an invalid assertion (a function can be referenced in
GRExprEngine::VisitDeclRefExpr without 'asLValue' being true).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 01:30:01 +00:00
Fariborz Jahanian b1663d0507 Produce detailed diagnostics when overload
resolution failed to select a candidate due to
ambiguity in type conversion function selection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:58:07 +00:00
Anders Carlsson ac18b2e3af Cast the array size expr to a size_t
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:37:25 +00:00
Douglas Gregor 86d802e03a Print the results of code-completion for overloading by displaying the
signature of the function with the current parameter highlighted as a
placeholder.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82593 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:34:09 +00:00
Douglas Gregor 0594438e06 Separate the code-completion results for call completion from the
results for other, textual completion. For call completion, we now
produce enough information to show the function call argument that we
are currently on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-23 00:16:58 +00:00
Douglas Gregor 8e0a0e4e45 Make sure we don't try to add code-completion results without an
active shadow map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:31:26 +00:00
Douglas Gregor 3e7253f155 When code-completion finds a declaration only because it is usable as
the start of a nested-name-specifier, add the "::" after the
nested-name-specifier to the code-completion string.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:22:24 +00:00
Douglas Gregor 0563c2677c Tweak the code-completion results ranking and formation, so that
members found in base classes have the same ranking as members found
in derived classes. However, we will introduce an informative note for
members found in base classes, showing (as a nested-name-specifier)
the qualification to name the base class, to make it clear which
members are from bases.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 23:15:58 +00:00
Anders Carlsson 16d81b8db3 Move codegen of new and delete to CGCXXExpr.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:53:17 +00:00
Mike Stump 45504e568c Remove now fixed FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:31:44 +00:00
Daniel Dunbar f44c585632 Push "clang-is-production" logic up to tools/driver, and make it hittable by
defining the CLANG_IS_PRODUCTION Makefile variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:31:13 +00:00
Anders Carlsson 592a2bbc19 No need to null check implicit lvalue cast exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 22:00:46 +00:00
Anders Carlsson dfd0330267 When doing a derived-to-base class and the class offset is 0 we can just do a simple bitcast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82579 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:58:22 +00:00
Daniel Dunbar dff10dcee0 Reconcile Clang/ARM target data string with llvm-gcc (module eabi weirdness).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:44:58 +00:00
Douglas Gregor b3d4525c65 Teach code-completion to introduce a ", ..." placeholder for variadic functions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:42:17 +00:00
Douglas Gregor ed5d651b0d In C++, a variadic function does not need an ellipsis prior to the comma. Parse it in both C and C++, but diagnose it as an error in C with a fix-it hint to add the comma.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:41:40 +00:00
Ted Kremenek cf54959eae Fix: <rdar://problem/7242006> [RegionStore] compound literal assignment with floats not honored
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:19:14 +00:00
Douglas Gregor b657f115c3 Replace the -code-completion-dump option with
-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 21:11:38 +00:00
Anders Carlsson add28829c7 CXXMethodDecls should always be mangled, even if they are inside an extern "C" block. Fixes PR5017.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 20:33:31 +00:00
Fariborz Jahanian 17c7a5d7ae Code refactoring and cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 20:24:30 +00:00
Fariborz Jahanian 455acd9452 Issue good ambiguity diagnostic when convesion fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82565 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 19:53:15 +00:00
Anders Carlsson 56cfdc183e If we already set a primary base, don't set it to the first nearly empty base class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 19:16:59 +00:00
Anders Carlsson 8ebcdfe799 Fix speling error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 19:15:56 +00:00
Anders Carlsson 0cd40e4f90 Explicitly initialize the PrimaryBase and PrimaryBaseWasVirtual members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 18:21:58 +00:00
Mike Stump a48f552c74 Yes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 17:38:02 +00:00
Anders Carlsson 90756300f3 (With Doug's help) fix a crash in the code completion code that lead to a test failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 17:29:51 +00:00
Anders Carlsson 5cc58c6cfe Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 17:23:30 +00:00
Fariborz Jahanian b2ef1beb81 Fix a regression in accessing class getter using the dot-syntax
notation. There is still an issue accessing field of a 'Class''s isa
in legacy code using dot field access notation (as noted in the test case)
but unrelated to this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 16:48:37 +00:00
Douglas Gregor 9c6a0e92db Implement code completion within a function call, triggered after the
opening parentheses and after each comma. We gather the set of visible
overloaded functions, perform "partial" overloading based on the set
of arguments that we have thus far, and return the still-viable
results sorted by the likelihood that they will be the best candidate.

Most of the changes in this patch are a refactoring of the overloading
routines for a function call, since we needed to separate out the
notion of building an overload set (common to code-completion and
normal semantic analysis) and then what to do with that overload
set. As part of this change, I've pushed explicit template arguments
into a few more subroutines.

There is still much more work to do in this area. Function templates
won't be handled well (unless we happen to deduce all of the template
arguments before we hit the completion point), nor will overloaded
function-call operators or calls to member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 15:41:20 +00:00
Daniel Dunbar e119e84ea5 Spell function pointer correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82543 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 10:19:04 +00:00
Daniel Dunbar 932eb6dd3f Add safe part of previous (reverted) commit, necessary to update to LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82540 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 10:06:21 +00:00
Daniel Dunbar f015b03415 Revert "Switch a few clients over to StringLiteral::getString.", this is breaking some projects, but I don't have a test case yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 10:03:52 +00:00
Daniel Dunbar 7f8b57aa35 Update PCH serialization of FunctionDecl flags.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 05:38:14 +00:00
Daniel Dunbar f3c740eb2c Allow PCH files to be read from stdin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 05:38:01 +00:00
Ted Kremenek cc969fd836 Fix: <rdar://problem/7242015> [RegionStore] variable passed-by-reference (via integer) to function call not invalidated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 04:48:39 +00:00
Daniel Dunbar df4eee9b03 Switch a few clients over to StringLiteral::getString.
- Switching all of them out-of-my-current-scope-of-interest, sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:27:52 +00:00
Daniel Dunbar b648023da2 Add StringLiteral::getString -> StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82514 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:27:33 +00:00
Anders Carlsson 3f06652234 Store the set of indirect primary bases directly in the record layout builder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82513 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:02:06 +00:00
Mike Stump fd47b31be0 Fix some typos. WIP. Large alignments don't work yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82512 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:44:17 +00:00
Mike Stump 196efbf095 Fix doc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:43:44 +00:00
Mike Stump 39605b4eab Improve debug info generation for __block variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82508 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 02:12:52 +00:00
Anders Carlsson e4feb834fb Record layout builder cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82502 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 00:04:45 +00:00
John McCall 183700f494 Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely.  Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:43:11 +00:00
Fariborz Jahanian b924259cc5 Removed -fobjc-newgc-api option. clang now conforms to
gcc-style write-barrier api only.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82493 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 23:03:37 +00:00
Ted Kremenek 69181a863c Provide intermediate solution to handling assignments to structs via an
integer pointer.  For now just invalidate the fields of the struct.

This addresses: <rdar://problem/7185607> [RegionStore] support invalidation of bit fields using integer assignment



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 22:58:52 +00:00
Douglas Gregor 791215b7a2 Code completion for ordinary names when we're starting a declaration, expression, or statement
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 20:51:25 +00:00
Douglas Gregor 456c4a17f4 When providing a code-completion suggestion for a hidden name, include
a nested-name-specifier that describes how to refer to that name. For
example, given:

  struct Base { int member; };
  struct Derived : Base { int member; };

the code-completion result for a member access into "Derived" will
provide both "member" to refer to Derived::member (no qualification needed) and
"Base::member" to refer to Base::member (qualification included).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82476 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 20:12:40 +00:00
Douglas Gregor b9d0ef7634 Enhance "case" code completion in C++ to suggest qualified names for
enumerators when either the user intentionally wrote a qualified name
(in which case we just use that nested-name-specifier to match
the user's code) or when this is the first "case" statement and we
need a qualified name to refer to an enumerator in a different scope.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 19:57:38 +00:00
Fariborz Jahanian fd02ed702e Miscellanous fixes in generatation of objc gc's write-barriers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 18:54:29 +00:00
Douglas Gregor 3e1005f085 Code completion for "case" statements within a switch on an expression
of enumeration type, providing the various unused enumerators as options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 18:10:23 +00:00
Douglas Gregor 86d9a52c24 Refactor and simplify the CodeCompleteConsumer, so that all of the
real work is performed within Sema. Addresses Chris's comments, but
still retains the heavyweight list-of-multimaps data structure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 16:56:56 +00:00
Daniel Dunbar ab8e281b32 Add missing PCH support for -fstack-protector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 04:16:19 +00:00
Chris Lattner 21190d5463 Implement __builtin_unreachable(), a GCC 4.5 extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:09:59 +00:00
Daniel Dunbar d5b6126389 Change ASTUnit to only initialize the predefines buffer to the suggested predefines.
- It isn't really clear what to do with the preprocessor here, but this is more sensible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:47 +00:00
Daniel Dunbar 31b87d8006 Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 03:03:39 +00:00
Anders Carlsson d553f8c57f Start mangling expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-21 01:21:10 +00:00
Daniel Dunbar 65f13c3381 Ok, an AssertingVH definitely doesn't work for now because we free our cache after the optimizer may have hacked on the module. Use a WeakVH instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:17:48 +00:00
Nick Lewycky 0d36dd28bb Make clang stop relying on ConstantStruct::get's default value for isPacked
which will be going away (ie. it's becoming a required parameter) later today.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82323 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 20:00:52 +00:00
Daniel Dunbar 23e81bae8c Switch CGDebugInfo type cache to using an AssertingVH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:27:24 +00:00
Daniel Dunbar 03faac3b8c Factor out CGDebugInfo::CreateTypeNode method.
- No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:27:14 +00:00
Douglas Gregor ff360b64a6 In C++ code completion, only suggest the "template" keyword after ".",
"->", or "::" if we will be looking into a dependent context. It's not
wrong to use the "template" keyword, but it's to needed, either.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 23:55:56 +00:00
Douglas Gregor 63f07c55d5 Make the construction of the code-completion string for a function
template smarter, by taking into account which function template
parameters are deducible from the call arguments. For example,

  template<typename RandomAccessIterator>
  void sort(RandomAccessIterator first, RandomAccessIterator last);

will have a code-completion string like

  sort({RandomAccessIterator first}, {RandomAccessIterator last})

since the template argument for its template parameter is
deducible. On the other hand,

  template<class X, class Y>
  X* dyn_cast(Y *Val);

will have a code-completion string like

  dyn_cast<{class X}>({Y *Val})

since the template type parameter X is not deducible from the function
call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82306 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 23:21:38 +00:00
Douglas Gregor 56ff871ae7 Introduce code completion patterns for templates, which provide the
angle brackets < > along with placeholder template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:47:56 +00:00
Ted Kremenek e0a58073b7 Re-introduce diagnostic caching in BugReporter that was originally added in
r82198 and then reverted. This is an intermediate solution, as diagnostic
caching should not rely on static variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:37:37 +00:00
Ted Kremenek db8338a35f Reintroduce FoldingSet profiling for PathDiagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:33:39 +00:00
Ted Kremenek 75d03cffe2 Fix regression introduced by r82198 that caused functions/methods with invalid CFGs to get analyzed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:29:35 +00:00
Douglas Gregor e6e0361984 Introduce code completion strings, which describe how to *use* the
results of code completion, e.g., by providing function call syntax
with placeholders for each of the parameters.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 22:15:54 +00:00
Anders Carlsson 2ee3fca27a More mangling work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:11:09 +00:00
Douglas Gregor ed8d322b40 C++ code completion after the "operator" keyword. Provide overloaded
operators, type specifiers, type names, and nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 20:05:18 +00:00
Anders Carlsson eafc6dcf67 Make the mangler conform even better to the grammar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:44:50 +00:00
Anders Carlsson 4bf4e3034e Make our char vector types not be explicitly signed to match GCC and to fix compilation with C++ and -fno-lax-vector-conversions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:18:19 +00:00
Mike Stump 97f4d46e2f Generate more of the vbase virtual offset for covariant thunks. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:06:35 +00:00
Douglas Gregor 49f40bd0c9 Introduce four new code-completion hooks for C++:
- after "using", show anything that can be a nested-name-specifier.
  - after "using namespace", show any visible namespaces or namespace aliases
  - after "namespace", show any namespace definitions in the current scope
  - after "namespace identifier = ", show any visible namespaces or
    namespace aliases



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:03:04 +00:00
Anders Carlsson 2744a063f1 More mangler mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:00:18 +00:00
Anders Carlsson aa73ab1bd0 Call mangleTemplatePrefix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:47:07 +00:00
Anders Carlsson 9263e91e2e Change manglePrefix to return early if the DC is the translation unit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:39:58 +00:00
Douglas Gregor 5836b010d0 Don't perform name lookup into a given declaration context more than once during code completion
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:07:23 +00:00
Douglas Gregor 75b7128e93 Handle using declarations and overload sets in code completion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 17:54:00 +00:00
Douglas Gregor 33224e61bf For code completion in C++ member access expressions and tag names,
look into the current scope for anything that could start a
nested-names-specifier. These results are ranked worse than any of the
results actually found in the lexical scope.

Perform a little more pruning of the result set, eliminating
constructors, __va_list_tag, and any duplication of declarations in
the result set. For the latter, implemented
NamespaceDecl::getCanonicalDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 17:42:29 +00:00
Anders Carlsson 9436ed50b0 Fix PR4923.
Fix error in _mm_set_pd/_mm_setr_pd and add _mm_set_epi64x/_mm_set1_epi64x. Patch by Laurent Morichetti!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82228 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 17:03:55 +00:00
Douglas Gregor b1c28a1f7e When gathering results for code completion, only include hidden
results when there is some way to refer to them in the language, such
as with a qualified name in C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 15:51:54 +00:00
Douglas Gregor 374929f7e8 Implement code completion for tags, e.g., code completion after "enum"
will provide the names of various enumerations currently
visible. Introduced filtering of code-completion results when we build
the result set, so that we can identify just the kinds of declarations
we want.

This implementation is incomplete for C++, since we don't consider
that the token after the tag keyword could start a
nested-name-specifier. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 15:37:17 +00:00
Daniel Dunbar f515b2268f Disable questionable code for handling isNullPointerConstant on value dependent
expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82217 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:46:16 +00:00
Daniel Dunbar 1d4612b829 Split Darwin toolchain into Clang and GCC Darwin toolchains with a common base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:15:13 +00:00
Daniel Dunbar 6cd4154b90 Lift AddLinkRuntimeLibArgs into Darwin tool chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:15:03 +00:00
Daniel Dunbar 608d04cb7b Move isMacosxVersionLT helpers to Darwin tool chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82211 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:14:55 +00:00
Daniel Dunbar 48d5aae438 Lift getMacosxVersionMin out into Darwin ToolChain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:14:46 +00:00
Daniel Dunbar 6b200b2b69 Lift AddLinkerSearchPaths() into Darwin tool chain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:14:36 +00:00
Daniel Dunbar ae54af2fdc Rename a variable to match its semantics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 08:14:24 +00:00
Ted Kremenek 7f473c5466 Revert most of r82198, which was causing a large number of crashes
when running the analyzer on real projects.  We'll keep the change to
AnalysisManager.cpp in r82198 so that -fobjc-gc analyzes code
correctly in both GC and non-GC modes, although this may emit two
diagnostics for each bug in some cases (a better solution will come
later).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 07:31:15 +00:00
Ted Kremenek 6a19832d08 Introduce caching of diagnostics in BugReporter. This provides extra
pruning of diagnostics that may be emitted multiple times.  This is
accomplished by adding FoldingSet profiling support to PathDiagnostic,
and then having BugReporter record what diagnostics have been issued.

This was motived to a serious bug introduced by moving the
'divide-by-zero' checking outside of GRExprEngine into a separate
'Checker' class.  When analyzing code using the '-fobjc-gc' option, a
given function would be analyzed twice, but the second time various
"internal checks" would be disabled to avoid emitting multiple
diagnostics (e.g., "null dereference") for the same issue.  The
problem is that such checks also effect path pruning and don't just
emit diagnostics.  This resulted in an assertion failure involving a
real divide-by-zero in some analyzed code where we would get an
assertion failure in APInt because the 'DivZero' check was disabled
and didn't prune the logic that resulted in the divide-by-zero in the
analyzer.

The implemented solution is somewhat of a hack, and may not perform
extremely well.  This will need to be cleaned up over time.

As a regression test, 'misc-ps.m' has been modified so that its tests
are run using -fobjc-gc to test this diagnostic pruning behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 05:37:41 +00:00
Chris Lattner f1affe6129 don't stick an uninitialized 'stat' buf into the stat cache, fill it
with zeros.  This avoids a GCC warning (PR5000)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 04:51:01 +00:00
Anders Carlsson 7482e24716 More mangling goodness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 04:29:09 +00:00
Anders Carlsson 7624f21938 Handle mangling of TemplateSpecializationType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 02:42:01 +00:00
Fariborz Jahanian 1c1afc4ed3 Fixed a bug in generation of the new write-barriers when
array syntax is used to derefernce and assign to ivar pointee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 00:04:00 +00:00
Douglas Gregor 81b747b7fc Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 21:32:03 +00:00
Mike Stump 10880397d2 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 21:15:00 +00:00
Douglas Gregor d85cef5a54 Merge uninstantiated default arguments more carefully, and try not to
complain about specializations of member functions that are not
definitions. Fixes PR4995.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 19:51:30 +00:00
Daniel Dunbar e1f63b38a0 ARM: Incremental improvement to preprocessor defines.
- Based on patch by Shantonu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 16:21:10 +00:00
Anders Carlsson d58d6f778d Ignore extern "C++" { } when mangling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 16:12:20 +00:00
Daniel Dunbar c1f2cddb8c Add ARM register names and aliases.
- Patch by Shantonu Sen!

<rdar://problem/6922650> clang doesn't know about ARM registers for inline asm clobber lists

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 07:03:19 +00:00
Daniel Dunbar 20f0eacf16 Driver: Change -O to mean -O2, -O1 is meaningless.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 06:53:36 +00:00
Daniel Dunbar 3f180c6189 Fix two crashes on value dependent expressions (shift and null-pointer check).
- Doug, please check.

 - PR4940.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 06:31:27 +00:00
Daniel Dunbar 7e88a60d38 Remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 06:31:17 +00:00
Anders Carlsson 068f347772 Revert r82123 for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 05:31:47 +00:00
Anders Carlsson b237fd6f36 Temporary band-aid for handling empty classes somewhat better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:42:56 +00:00
Anders Carlsson 657094b1ad Treat an unqualified RecordType as a RecordDecl when substituting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82123 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:38:23 +00:00
Anders Carlsson 6862fc720b Substitution for prefixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:16:28 +00:00
Daniel Dunbar 634b24563b Improve driver error message when only running the preprocessor and an input is
already preprocessed.

--
ddunbar@giles:tmp$ touch t.i
ddunbar@giles:tmp$ gcc -E t.i
ddunbar@giles:tmp$ clang -E t.i
clang: warning: t.i: previously preprocessed input unused when '-E' is present
ddunbar@giles:tmp$ 
--

<rdar://problem/6813375> [driver] driver prints confusing message when running -E on preprocessed file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:13:26 +00:00
Anders Carlsson 03c9d530db Substitute unscoped template names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:02:31 +00:00
Daniel Dunbar 6793966aa2 IRgen/ObjC: Correctly construct the function info for variadic message sends.
This fixes some bad -O0 codegen and the unnecessary clearing of al on entry to objc_msgSend for most message sends.

<rdar://problem/7102824> [irgen] unnecessary xorb on calls to objc_msgSend on x86_64

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:01:40 +00:00
Daniel Dunbar d6c93d7035 IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 04:01:22 +00:00
Anders Carlsson d3a932a298 Add mangleSubstitution/addSubstitution variants that take a NamedDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:53:28 +00:00
Anders Carlsson 9234b7ff2b When mangling function template specialization, mangle the type encoding of the original function template. Also, port mangle.cpp and function-template-specialization.cpp over to using FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:46:43 +00:00
Anders Carlsson 201ce7485c Add new functions to the mangler for the <unscoped-name> and <unscoped-template-name> productions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:17:01 +00:00
Daniel Dunbar e24d38f692 PCH: When writing PCH files, tweak the predicate function deciding whether to mark a decl as "external" to be closer to reality.
This still isn't perfect, but I believe it is conservatively accurate at marking decls which IRgen needs to see, while still keeping the "deserialization footprint" on Cocoa.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:06:51 +00:00
Daniel Dunbar 04a0b50e19 PCH: When deserializing an explicit "external definition", don't pass it to HandleTopLevelDecl -- this is already being done inside the reader.
This is something of a hack, since whether the reader actually did this depends on the "isConsumerInterestedIn" predicate. I think we need to rework how this works, but I need to discuss with Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 03:06:44 +00:00
Daniel Dunbar e3b8d07e02 We don't need a -compile-ast clang-cc action, we can just use -S.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:47:53 +00:00
Anders Carlsson 7696737d41 Add basic substitution to the C++ mangler. It currently only looks at types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 00:43:46 +00:00
Anders Carlsson 83913e36c8 When creating function types, remove any top-level CVR qualifications in the function type argument types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 23:47:08 +00:00
Fariborz Jahanian dbf3cfd39d patch for generating objc'2 objc_assign_ivar. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 23:11:23 +00:00
John McCall dd4a3b0065 Improved representation and support for friend class templates. Angst about same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:47:08 +00:00
Fariborz Jahanian b123ea395e Starting patch to generate more specific API for objc's
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82082 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 21:37:16 +00:00
Mike Stump 197c8d9ef0 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 20:41:09 +00:00
Anders Carlsson 0de51bc612 Improve handling of vector casts in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 19:19:43 +00:00
Douglas Gregor e95b409613 Teach Sema::FindInstantiatedDecl to find instantiated RecordDecls even
when we are not instantiating the corresponding "current
instantiation." This happens, e.g., when we are instantiating a
declaration reference that refers into the "current instantiation" but
occurs in a default function argument. The libstdc++ vector default
constructor now instantiates properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:34:49 +00:00
Fariborz Jahanian 59a53fa3f8 Do not generate write-barrier in indirect assignment to
a weak object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 18:09:18 +00:00
Fariborz Jahanian 8e674aea31 Removed a superfluous check before setting
a flag (objc GC).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 16:49:08 +00:00
Anders Carlsson 0a8f847e97 x86-64 ABI: If a type is a C++ record with either a non-trivial destructor or a non-trivial copy constructor, it should be passed in a pointer. Daniel, plz review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 15:53:40 +00:00
Benjamin Kramer 37473829cb PR4991: Properly remove trailing newline from __TIMESTAMP__.
Replace strcpy with memcpy while at it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82043 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 13:10:04 +00:00
Daniel Dunbar 6bea73b330 Incremental improvement to logic determining whether we emit unwind tables or
not.
 - PR4932.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82021 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:17:29 +00:00
Ted Kremenek 7c039bf4d8 Have divide-by-zero checker not handled undefined denominators. This is handled by the generic checking for undefined operands for BinaryOperators.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:04:26 +00:00
Ted Kremenek 76823024e0 Remove ImplicitBadDivides/ExplicitBadDivides node sets. This checking is now down by a 'Checker' and not build into GRExprEngine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 06:03:39 +00:00
Chris Lattner e94e0d413f fix some ppc register name issues, patch by Richard Pennington!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 05:05:27 +00:00
Mike Stump f918b8f934 Collapse more clang version numbers down into fewer places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 01:26:05 +00:00
Douglas Gregor 861d0e846e Fix a typo in a FIXME
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81960 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 00:01:48 +00:00
Mike Stump 1f2c32e61c Back to 1.1 we go.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 23:04:22 +00:00
Fariborz Jahanian a5c1294b2c In building list of visible conversion functions, use
result type of template convesion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 23:02:16 +00:00
Douglas Gregor 7adb10fa31 When implicitly declaring operators new, new[], delete, and delete[],
give them the appropriate exception specifications. This,
unfortunately, requires us to maintain and/or implicitly generate
handles to namespace "std" and the class "std::bad_alloc". However,
every other approach I've come up with was more hackish, and this
standard requirement itself is quite the hack.

Fixes PR4829.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 22:30:29 +00:00
Fariborz Jahanian 8b915e7048 1) don't do overload resolution in selecting conversion
to pointer function for delete expression. 2)
Treat type conversion function and its 'const' version
as identical in building the visible conversion list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 22:15:23 +00:00
Mike Stump 5a8621732d Be sure to use the correct version instead of inventing the wrong one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 21:48:34 +00:00
Anders Carlsson 7171011353 Add back the workaround since it lead to constructor conversion bugs :(
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81917 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 21:14:33 +00:00
Douglas Gregor 14e0b3d8a5 Make sure we're comparing the canonical types when we determine
whether a constructor is a copy constructor.

Sadly, I wasn't able to get down to a test case smaller than libstdc++'s
<string>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 20:50:23 +00:00
Douglas Gregor 1fdd89ba1d When printing an overload candidate that is a function template specialization,
point at the template and print out its template arguments, e.g.,

ambiguous-ovl-print.cpp:5:8: note: candidate function template specialization
      [with T = int]
  void f(T*, long);




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 20:11:42 +00:00
Fariborz Jahanian 34acd3e62c Issue good diagnostics when initialization failes due to
ambiguity in type conversion function selection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 19:12:21 +00:00