Commit Graph

5714 Commits

Author SHA1 Message Date
Daniel Dunbar 3780f0b680 x86_64: Structures with no fields but which have padding should be classified as
integer.
 - This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
 - PR5831.

llvm-svn: 91874
2009-12-22 01:19:25 +00:00
Douglas Gregor 4141d5bea2 When converting from a type to itself or one of its base classes via a
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.

llvm-svn: 91861
2009-12-22 00:21:20 +00:00
Douglas Gregor 2bb0765bb4 When filling in value initializations within an initializer list, be
sure to fill in the initialized member of a union when a member was
explicitly designated. Fixes PR5843.

llvm-svn: 91858
2009-12-22 00:05:34 +00:00
Daniel Dunbar 0def3d17cb ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly".
- Correctly is in quotes, because we are following what I interpreted as GCC's
   intent (which diverges from practice, naturally).
 - Also, fix the arch define for arm1136jf-s.

llvm-svn: 91855
2009-12-21 23:28:17 +00:00
Douglas Gregor 8364e6b568 When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.

llvm-svn: 91852
2009-12-21 23:17:24 +00:00
Fariborz Jahanian ffc420cb51 Allow comparison of 'void *' with function pointer
as a g++ extension (fixes radar 7481987).

llvm-svn: 91827
2009-12-21 18:19:17 +00:00
Eli Friedman 9025ec2ee5 Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.

"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though; 
it doesn't ignore namespaces.  Someone more familiar with the lookup code
should fix this properly.

llvm-svn: 91809
2009-12-21 01:42:38 +00:00
Anders Carlsson 9a98ac993f Add tests for structs inside anonymous namespaces.
llvm-svn: 91806
2009-12-21 00:57:38 +00:00
Anders Carlsson 2b7f444366 Incomplete structs should also have internal linkage.
llvm-svn: 91805
2009-12-21 00:41:42 +00:00
Anders Carlsson 18e6ee1b20 Correcly handle pointers to member pointer types where the class or the pointee is incomplete.
llvm-svn: 91804
2009-12-20 23:37:55 +00:00
Nuno Lopes 518e370719 fix PR4010: add support for the warn_unused_result for function pointers
llvm-svn: 91803
2009-12-20 23:11:08 +00:00
Chris Lattner 1576850a76 fix PR5500: clang fails to parse inline asm with :: in C++ mode
llvm-svn: 91802
2009-12-20 23:08:04 +00:00
Chris Lattner 2fe080c83e a really old testcase I apparently forgot to 'svn add'.
llvm-svn: 91800
2009-12-20 23:00:15 +00:00
Anders Carlsson d008129f34 Rework the way pointer types are handled by the RTTI builder. We now get the right linkage for indirect pointers to incomplete structs.
llvm-svn: 91799
2009-12-20 22:30:54 +00:00
Eli Friedman 7dac3712a2 Make sure we instantiate the destructor for variables initialized by
assignment.

llvm-svn: 91798
2009-12-20 22:29:11 +00:00
Douglas Gregor 39c778b443 Switch default-initialization of variables of class type (or array thereof) over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one
llvm-svn: 91796
2009-12-20 22:01:25 +00:00
John McCall 1c7e6ec27b Don't inject the class name until that magical lbrace.
Because of the rules of base-class lookup* and the restrictions on typedefs, it
was actually impossible for this to cause any problems more serious than the
spurious acceptance of
  template <class T> class A : B<A> { ... };
instead of
  template <class T> class A : B<A<T> > { ... };
but I'm sure we can all agree that that is a very important restriction which
is well worth making another Parser->Sema call for.

(*) n.b. clang++ does not implement these rules correctly;  we are not ignoring
    non-type names

llvm-svn: 91792
2009-12-20 07:58:13 +00:00
John McCall bffb990c23 Test the lookup I wasn't sure would be done properly after the last patch.
Clang reasonably adds all the base specifiers in one pass;  this is now required
for correctness to prevent lookup from going mad.  But this has the advantage of
establishing the correct context when looking up base specifiers, which will be
important for access control.

llvm-svn: 91791
2009-12-20 05:57:29 +00:00
John McCall 2d814c305e Parse base specifiers within the scope of the class. This is possibly not
quite right;  I'll come back to it later.  It does fix PR 5741.

llvm-svn: 91789
2009-12-19 21:48:58 +00:00
John McCall 6df5fef637 Refactor to remove more dependencies on PreDeclaratorDC. I seem to have made
the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can
live with that;  they'll need to be fixed more holistically anyhow.

llvm-svn: 91771
2009-12-19 10:49:29 +00:00
John McCall 1f4ee7bd2f Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope.  Resolves an ancient xfail and an LLVM misparse.

llvm-svn: 91769
2009-12-19 09:28:58 +00:00
Eli Friedman 7827520ce8 Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.

llvm-svn: 91767
2009-12-19 08:11:05 +00:00
Douglas Gregor 5103effb1d A CXXExprWithTemporaries expression is an lvalue if its subexpression
is an lvalue. Fixes PR5787.

llvm-svn: 91765
2009-12-19 07:07:47 +00:00
Zhongxing Xu 4794801e27 Use the FunctionDecl's result type to know exactly if it returns a reference.
llvm-svn: 91751
2009-12-19 03:17:55 +00:00
Douglas Gregor a4b592a7d5 Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization). 

Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.

llvm-svn: 91750
2009-12-19 03:01:41 +00:00
Anders Carlsson 6fda43f4c1 Correctly initialize the PrimaryBaseInfo if a base is null. Fixes PR5832.
llvm-svn: 91748
2009-12-19 02:13:41 +00:00
John McCall 7173903ea6 Unresolved implicit member accesses are dependent if the object type is dependent.
Avoids an assertion arising during object-argument initialization in overload
resolution.  In theory we can resolve this at definition time if the class
hierarchy for the member is fully known.

llvm-svn: 91747
2009-12-19 02:05:44 +00:00
John McCall e2ade289be Teach TryAnnotateTypeOrScopeToken to deal with already-annotated
scope specifiers.  Fix a tentative parsing bug that came up in LLVM.
Incidentally fixes some random FIXMEs in an existing testcase.

llvm-svn: 91734
2009-12-19 00:35:18 +00:00
Eli Friedman 357e8c94d6 Fix for PR5524: make reference binding in default argument work correctly.
llvm-svn: 91733
2009-12-19 00:20:10 +00:00
Eli Friedman 726b878574 Test for r91724.
llvm-svn: 91730
2009-12-18 23:42:55 +00:00
Ted Kremenek af1bdd71af Enhance GRExprEngine::VisitCallExpr() to be used in an lvalue context. Uncovered a new failing test case along the way, but we're making progress on handling C++ references in the analyzer.
llvm-svn: 91710
2009-12-18 20:13:39 +00:00
Douglas Gregor b3fa919c2d Extend code-completion results with the type of each result
llvm-svn: 91702
2009-12-18 18:53:37 +00:00
Daniel Dunbar acde99ea52 ARM: Fix predefines (__ARM_ARCH_..., __REGISTER_PREFIX).
- This should be done leveraging the backend, but I'm a little refactored
   out. I'll fix it one day, I promise.

llvm-svn: 91700
2009-12-18 18:42:37 +00:00
Anders Carlsson 0087bc851c Fix regression I introduced when dynamic_cast-ing to a reference type.
llvm-svn: 91687
2009-12-18 14:55:04 +00:00
Anders Carlsson b396f43520 It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
llvm-svn: 91686
2009-12-18 14:42:03 +00:00
John McCall d43784feae Set up the semantic context correctly when declaring a friend class template.
llvm-svn: 91678
2009-12-18 11:25:59 +00:00
John McCall ea305edd63 Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria into
different functions and pick the function at lookup initialization time.
In theory we could actually divide the criteria functions into N different
functions for the N cases, but it's so not worth it.

Among other things, lets us invoke LookupQualifiedName without recomputing
IDNS info every time.

Do some refactoring in SemaDecl to avoid an awkward special case in LQN
that was only necessary for redeclaration testing for anonymous structs/unions ---
which could be done more efficiently with a scoped lookup anyway.

llvm-svn: 91676
2009-12-18 10:40:03 +00:00
Daniel Dunbar a7d0231b66 clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Douglas Gregor e1314a64b8 Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:

  - InitializationSequence now has a "C conversion sequence" category
    and step kind, which falls back to
  - Changed the diagnostics for returns to always have the result type
    of the function first and the type of the expression second.
    CheckSingleAssignmentConstraints to peform checking in C. 
  - Improved ASTs for initialization of return values. The ASTs now
    capture all of the temporaries we need to create, but
    intentionally do not bind the tempoary that is actually returned,
    so that it won't get destroyed twice.
  - Make sure to perform an (elidable!) copy of the class object that
    is returned from a class.
  - Fix copy elision in CodeGen to properly see through the
    subexpressions that occur with elidable copies.
  - Give "new" its own entity kind; as with return values and thrown
    objects, we don't bind the expression so we don't call a
    destructor for it.

Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.

llvm-svn: 91669
2009-12-18 05:02:21 +00:00
Daniel Dunbar 24c7f5efc5 Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
to compile a translation unit into the debug info for that file.
 - Used by parts of Darwin build process to check compiler flags, etc.
 - <rdar://problem/7256886> clang does not emit AT_APPLE_flags

llvm-svn: 91661
2009-12-18 02:43:17 +00:00
Fariborz Jahanian 6ab7ed40c7 Implemented rewriting of invocation of a block ivar.
(radar 7482224).
 

llvm-svn: 91652
2009-12-18 01:15:21 +00:00
Eli Friedman fa7f519ce4 Temporarily XFAIL this test.
llvm-svn: 91643
2009-12-18 00:23:19 +00:00
Sean Callanan 12ca3f46d8 Testcase fixes to reflect instruction table changes in the LLVM backend
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html)
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.

* PR5050-constructor-conversion.cpp
* array-construction.cpp
* constructor-conversion.cpp
* cast-conversion.cpp
* constructor-default-arg.cpp
* derived-to-base-conv.cpp
* ptr-to-member-function.cpp
* call-arg-zero-temp.cpp
* default-destructor-synthesis.cpp
* global-array-destruction.cpp
* array-operator-delete-call.cpp
* decl-ref-init.cpp
* default-constructor-for-members.cpp
* convert-to-fptr.cpp
* constructor-for-array-members.cpp
* conversion-function.cpp
* objc-read-weak-byref.m
	Fixed testcase to reflect call qualifier

llvm-svn: 91640
2009-12-18 00:04:09 +00:00
John McCall 90d3bb943e Patch over yet more problems with friend declarations which were provoking
problems on LLVM-Code-Syntax.  This proved remarkably easy to "fix" once
I settled on how I was going to approach it.

llvm-svn: 91633
2009-12-17 23:21:11 +00:00
Mike Stump 6dc04f4067 Revert r91073.
llvm-svn: 91629
2009-12-17 22:14:41 +00:00
Nuno Lopes e9823fab83 implement PR3962: diagnose more faulty cases of usage of the restrict qualifier. this also removes a FIXME
llvm-svn: 91601
2009-12-17 11:35:26 +00:00
Nuno Lopes 641fdce235 revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz
llvm-svn: 91600
2009-12-17 10:15:49 +00:00
Chris Lattner 3dfff974ec reimplement r90860, fixing a couple of problems:
1. Don't make a copy of LangOptions every time a lexer is created.
2. Don't make CharInfo global mutable state.
3. Fix the implementation to properly treat ^Z as EOF instead of as
   horizontal whitespace, which matches the semantic implemented by VC++.

llvm-svn: 91586
2009-12-17 05:29:40 +00:00
Anders Carlsson 539e584c3c Attempt to fix rtti-layout.cpp on Linux.
llvm-svn: 91581
2009-12-17 04:57:25 +00:00
Anders Carlsson dc9b9cf7b1 Add a (currently failing) RTTI layout test.
llvm-svn: 91580
2009-12-17 04:41:05 +00:00