Commit Graph

16552 Commits

Author SHA1 Message Date
Mike Stump 7373095ebf Ensure we sign extend.
llvm-svn: 84031
2009-10-13 21:31:09 +00:00
Anders Carlsson f64a3dae04 Diagnose invalid return types for unary operators.
llvm-svn: 84030
2009-10-13 21:19:37 +00:00
Douglas Gregor e40876a50c Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.

llvm-svn: 84028
2009-10-13 21:16:44 +00:00
Anders Carlsson 8523d20af3 Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.
llvm-svn: 84026
2009-10-13 21:02:07 +00:00
Douglas Gregor 054060c4ec Give ourselves an A- on ASTs for explicit specializations, since they
aren't rich enough to reproduce the source accurately.

llvm-svn: 84012
2009-10-13 19:41:44 +00:00
John Thompson 4334ce6bda Fixes pth.c on Windows.
llvm-svn: 84007
2009-10-13 18:51:32 +00:00
John Thompson 271f1f07bc Converted to use FileCheck.
llvm-svn: 84005
2009-10-13 18:51:26 +00:00
John McCall 04f531238d Turn -Wparentheses on by default.
llvm-svn: 83993
2009-10-13 17:57:23 +00:00
Anders Carlsson 6bfee8f3e3 Don't assume that the LHS and RHS of a member pointer expression is a DeclRefExpr. Fixes PR5177.
llvm-svn: 83986
2009-10-13 17:41:28 +00:00
Mike Stump ad47e7ea81 Remove FIXME. We construct VBIndex very early, before any calls to OverrideMethod.
llvm-svn: 83981
2009-10-13 17:23:44 +00:00
Douglas Gregor 62e10f0bdc Diagnose attempts to add default function arguments to a
specialization. This completes C++ [temp.expl.spec]!

llvm-svn: 83980
2009-10-13 17:02:54 +00:00
Devang Patel 9f73552852 Remove extra white space line.
llvm-svn: 83979
2009-10-13 17:02:38 +00:00
Devang Patel 7468489deb Do not check use_empty() before invoking replaceAllUsesWith().
Let replaceAllUsesWith() adjust VHs even though there are no uses.

llvm-svn: 83978
2009-10-13 17:02:04 +00:00
Edward O'Callaghan fc460554f6 -funit-at-a-time is the default however some current makefiles pass -fno-unit-at-a-time which is ignored by GCC, we should warn about this not error out.
llvm-svn: 83976
2009-10-13 16:41:34 +00:00
Douglas Gregor cf91555cb8 When explicitly specializing a member that is a template, mark the
template as a specialization. For example, this occurs with:

  template<typename T>
  struct X {
    template<typename U> struct Inner { /* ... */ };
  };

  template<> template<typename T>
  struct X<int>::Inner {
    T member;
  };

We need to treat templates that are member specializations as special
in two contexts:

  - When looking for a definition of a member template, we look
    through the instantiation chain until we hit the primary template
    *or a member specialization*. This allows us to distinguish
    between the primary "Inner" definition and the X<int>::Inner
    definition, above.
  - When computing all of the levels of template arguments needed to
    instantiate a member template, don't add template arguments
    from contexts outside of the instantiation of a member
    specialization, since the user has already manually substituted
    those arguments.

Fix up the existing test for p18, which was actually wrong (but we
didn't diagnose it because of our poor handling of member
specializations of templates), and add a new test for member
specializations of templates.

llvm-svn: 83974
2009-10-13 16:30:37 +00:00
Douglas Gregor 3a88c1d784 Improve the internal representation and semantic analysis of friend
function templates.

This commit ensures that friend function templates are constructed as
FunctionTemplateDecls rather than partial FunctionDecls (as they
previously were). It then implements template instantiation for friend
function templates, injecting the friend function template only when
no previous declaration exists at the time of instantiation. 

Oh, and make sure that explicit specialization declarations are not
friends.

llvm-svn: 83970
2009-10-13 14:39:41 +00:00
Mike Stump 87876a0053 Refine handling for return value conversions with respect to virtual
offsets for covariant thunks.

llvm-svn: 83965
2009-10-13 10:55:21 +00:00
Benjamin Kramer abd5b90e4c Simplify pointer creation with the new Type::getInt*Ptr methods.
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Chris Lattner 3eb172a02b Teach sema and codegen about the difference between address of labels,
which is a common idiom to improve PIC'ness of code using the addr of
label extension.  This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice.  This implements PR5131.

llvm-svn: 83957
2009-10-13 07:14:16 +00:00
Chris Lattner 2bb5cb490c reimplement codegen for indirect goto with the following advantages:
1. CGF now has fewer bytes of state (one pointer instead of a vector).
2. The generated code is determinstic, instead of getting labels in
   'map order' based on pointer addresses.
3. Clang now emits one 'indirect goto switch' for each function, instead
   of one for each indirect goto.  This fixes an M*N = N^2 IR size issue
   when there are lots of address-taken labels and lots of indirect gotos.
4. This also makes the default cause do something useful, reducing the
   size of the jump table needed (by one).

llvm-svn: 83952
2009-10-13 06:55:33 +00:00
Chris Lattner 9842a4dcb1 merge an indirect goto test into statements, add another
hairier (but nonsensical) example.

llvm-svn: 83951
2009-10-13 06:52:43 +00:00
Zhongxing Xu e02b89566a Return the original state by default.
llvm-svn: 83949
2009-10-13 06:07:58 +00:00
Chris Lattner 92ae16b0ae number address-taken labels from 1. This allows 0 to be used as a sentinel
for a null pointer.  In other words, "&&foo != NULL" will always work out to
true.

llvm-svn: 83948
2009-10-13 06:04:29 +00:00
Chris Lattner dd7eaad7d4 Use the new Type::getInt8PtrTy method. This should probably be used in a lot
more places in clang codegen now.

llvm-svn: 83947
2009-10-13 06:02:42 +00:00
John Thompson 9f2a365fe2 test commit
llvm-svn: 83945
2009-10-13 05:45:19 +00:00
Chris Lattner a611b45806 add rdar # I accidentally lost.
llvm-svn: 83942
2009-10-13 04:57:27 +00:00
Chris Lattner af066d818c merge two tests.
llvm-svn: 83941
2009-10-13 04:56:49 +00:00
Chris Lattner 1a6babf1f4 make the diagnostic in the 'unused result' warning more precise
about the reason, rdar://7186119.

llvm-svn: 83940
2009-10-13 04:53:48 +00:00
Chris Lattner f315471e24 fix PR4938 by recognizing % as a modifier on outputs,
previously we only recognized it on inputs.

llvm-svn: 83939
2009-10-13 04:32:07 +00:00
Zhongxing Xu 88dd1ff0d7 Now we can call into another function with the CallInliner transfer function.
llvm-svn: 83936
2009-10-13 02:36:42 +00:00
Zhongxing Xu 2d88c0b989 Add two utility methods.
llvm-svn: 83935
2009-10-13 02:29:58 +00:00
Zhongxing Xu daa4176926 Add an initial implementation of EnterStackFrame() to the StoreManager.
llvm-svn: 83934
2009-10-13 02:24:55 +00:00
Devang Patel 232f278fc1 Disable tests that check debug info intrinsic. This does not work if debug info intrinsics are not used to encode debug info.
llvm-svn: 83929
2009-10-12 23:46:58 +00:00
Devang Patel 5b294f4330 Enable "debug info attached to an instruction" mode.
llvm-svn: 83928
2009-10-12 23:31:25 +00:00
Douglas Gregor e3afaeb7e4 Minor CSS fix
llvm-svn: 83924
2009-10-12 23:15:14 +00:00
Douglas Gregor ef06ccf8d0 When declaring a class template whose name is qualified, make sure
that the scope in which it is being declared is complete. Also, when
instantiating a member class template's ClassTemplateDecl, be sure to
delay type creation so that the resulting type is dependent. Ick.

llvm-svn: 83923
2009-10-12 23:11:44 +00:00
Douglas Gregor 0347f40eba Minor margin fix
llvm-svn: 83918
2009-10-12 22:52:00 +00:00
Douglas Gregor 775b837976 Test explicit specialization involving multiple template<> headers
llvm-svn: 83914
2009-10-12 22:33:31 +00:00
Devang Patel dac79decf3 There is no need to attach debug location info with alloca instruction.
llvm-svn: 83913
2009-10-12 22:29:02 +00:00
Devang Patel 551e112e99 Encode long double.
llvm-svn: 83912
2009-10-12 22:28:31 +00:00
Douglas Gregor ca027af608 Permit explicit specialization of member functions of class templates
that are declarations (rather than definitions). Also, be sure to set
the access specifiers properly when instantiating the declarations of
member function templates.

llvm-svn: 83911
2009-10-12 22:27:17 +00:00
John McCall e724ae92a8 More appropriate API usage.
llvm-svn: 83910
2009-10-12 22:25:59 +00:00
John McCall d5707abdfd Implement -Wparentheses: warn about using assignments in contexts that require
conditions.  Add a fixit to insert the parentheses.  Also fix a very minor
possible memory leak in 'for' conditions.

Fixes PR 4876 and rdar://problem/7289172

llvm-svn: 83907
2009-10-12 21:59:07 +00:00
Douglas Gregor 2210c9cd6e Test explicit specializations of static data members that are declarations, not definitions
llvm-svn: 83904
2009-10-12 21:37:59 +00:00
Douglas Gregor a2fe1fe208 Yet another test for explicit specialization, this one involving linkage
llvm-svn: 83901
2009-10-12 21:21:22 +00:00
Anders Carlsson 1d116976b4 Store the key function of a record decl inside CGRecordLayout.
llvm-svn: 83900
2009-10-12 21:16:22 +00:00
Ted Kremenek 289ae4f454 Use a BumpPtrAllocator to allocate all aspects of CFG, including CFGBlocks, successor and predecessor vectors, etc.
Speedup: when doing 'clang-cc -analyze -dump-cfg' (without actual printing, just
CFG building) on the amalgamated SQLite source (all of SQLite in one source
file), runtime reduced by 9%.

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

llvm-svn: 83899
2009-10-12 20:55:07 +00:00
Mike Stump b9a9a7c0ad Fixup windows include paths. Patch by John Thompson.
llvm-svn: 83898
2009-10-12 20:50:45 +00:00
Douglas Gregor 1fc79dda69 More tests for explicit template specialization
llvm-svn: 83896
2009-10-12 20:45:50 +00:00
Douglas Gregor 00bb0cbfa5 Add test for last commit
llvm-svn: 83893
2009-10-12 20:23:10 +00:00