Commit Graph

28886 Commits

Author SHA1 Message Date
Douglas Gregor 55e6b31511 Patch up several Sema::FindInstantiatedDecl() callers, so that they'll
properly cope with NULL return values.

llvm-svn: 127024
2011-03-04 19:46:35 +00:00
Devang Patel d3a6b0f184 Emit a stop point before a call expression so that debugger has some chance of getting some footing when user wants to stop at 2nd bar() in following expression when all function calls are inlined.
= bar() + ... + bar() + ...

clang keeps track of column numbers, so we could put location entries for all subexpressions but that will significantly bloat debug info in general, but a location for call expression is helpful here.

llvm-svn: 127018
2011-03-04 18:54:42 +00:00
Douglas Gregor 23648d7e3b When constructing source-location information for a
DependentTemplateSpecializationType during tree transformation, retain
the NestedNameSpecifierLoc as it was used to translate the template
name, rather than reconstructing it from the template name.

Fixes PR9401.

llvm-svn: 127015
2011-03-04 18:53:13 +00:00
Douglas Gregor 3c41bf740f *Recursively* set the context of a template parameter, so that we also
capture the template parameters of template template parameters.

llvm-svn: 127012
2011-03-04 18:32:38 +00:00
Douglas Gregor fd7c225530 Make sure to put template parameters into their owning template's
DeclContext once we've created it. This mirrors what we do for
function parameters, where the parameters start out with
translation-unit context and then are adopted by the appropriate
DeclContext when it is created. Also give template parameters public
access and make sure that they don't show up for the purposes of name
lookup.

Fixes PR9400, a regression introduced by r126920, which implemented
substitution of default template arguments provided in template
template parameters (C++ core issue 150).

How on earth could the DeclContext of a template parameter affect the
handling of default template arguments?

I'm so glad you asked! The link is
Sema::getTemplateInstantiationArgs(), which determines the outer
template argument lists that correspond to a given declaration. When
we're instantiating a default template argument for a template
template parameter within the body of a template definition (not it's
instantiation, per core issue 150), we weren't getting any outer
template arguments because the context of the template template
parameter was the translation unit. Now that the context of the
template template parameter is its owning template, we get the
template arguments from the injected-class-name of the owning
template, so substitution works as it should.

llvm-svn: 127004
2011-03-04 17:52:15 +00:00
Abramo Bagnara b9893d66bc Fixed source range for function template specializations.
template <class T> void foo();
template <> void foo<int>(); /* Spec 1 */
template <> void foo<int>(); /* Spec 2 */

If we look at the main location of the first explicit specialization (Spec 1) it can be seen that it points to the name of the *second* explicit specialization (Spec 2), which is a redeclaration of Spec1.
Hence, the source range obtained for Spec1 is not only inaccurate, but also invalid (the end location comes before the start location).

llvm-svn: 127002
2011-03-04 17:20:30 +00:00
Abramo Bagnara a0935267dc Fixed source range for ClassTemplateSpecializationDecl.
llvm-svn: 126999
2011-03-04 14:20:30 +00:00
Benjamin Kramer 024e619f2a Move private structs into anonymous namespaces.
llvm-svn: 126997
2011-03-04 13:12:48 +00:00
Abramo Bagnara 23485e04be Improved TemplateTypeParmDecl end location.
llvm-svn: 126996
2011-03-04 12:42:03 +00:00
Abramo Bagnara e15d553663 Fixed end location of NonTypeTemplateParamDecl.
llvm-svn: 126994
2011-03-04 11:03:48 +00:00
Abramo Bagnara 36a95be4ea Fixed end location of FriendDecl.
llvm-svn: 126993
2011-03-04 10:59:18 +00:00
John McCall 8bc6d5b919 Don't consider visibility from template parameter lists if we're
computing for a nested decl with explicit visibility.  This is all part
of the general philosophy of explicit visibility attributes, where
any information that was obviously available at the attribute site
should probably be ignored.  Fixes PR9371.

llvm-svn: 126992
2011-03-04 10:39:25 +00:00
John McCall 74186ab391 Access ivars with inbounds GEPs, even in -fwrapv. It's unlikely that
this can have any optimization effect, given the opacity of objects pointers,
but you never know.

llvm-svn: 126990
2011-03-04 08:25:59 +00:00
John McCall 6647584951 Let's do super message sends with static allocas instead of dynamic ones.
llvm-svn: 126989
2011-03-04 08:00:29 +00:00
John McCall 4223a9ee7a Make AttributedTypes for GC-qualified types and fix some miscellaneous
bugs with such types.  Not sure this is quite how I want the desugaring
and a.k.a. logic to go, but it suffices.

llvm-svn: 126986
2011-03-04 04:00:19 +00:00
Ted Kremenek be52871b1a Correctly handle nested switch statements in CFGBuilder when on switch statement has a condition that evaluates to a constant.
llvm-svn: 126977
2011-03-04 01:03:41 +00:00
Argyrios Kyrtzidis 7a1778eba1 -Woverloaded-virtual shouldn't warn for static functions. Fixes rdar://9083431 & http://llvm.org/PR9396.
llvm-svn: 126966
2011-03-03 22:58:57 +00:00
Douglas Gregor 2b1ca9eaad Fix PR9390 in not one, but two ways:
1) When we do an instantiation of the injected-class-name type,
  provide a proper source location. This is just plain good hygiene.

  2) When we're building a NestedNameSpecifierLoc from a CXXScopeSpec,
  only return an empty NestedNameSpecifierLoc if there's no
  representation.

Both problems contributed to the horrible test case in PR9390 that I
couldn't reduce down to something palatable.

llvm-svn: 126961
2011-03-03 21:48:55 +00:00
Devang Patel 68a1525290 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

llvm-svn: 126960
2011-03-03 20:13:15 +00:00
Abramo Bagnara 124fdf6dd4 Fixed source range for LabelDecl.
llvm-svn: 126952
2011-03-03 18:24:14 +00:00
Argyrios Kyrtzidis e02831423a Don't emit unused warning for deleted functions. Fixes rdar://8365684 & http://llvm.org/PR9391.
llvm-svn: 126950
2011-03-03 17:47:42 +00:00
Douglas Gregor bd6b4447a7 Finish updated test
llvm-svn: 126948
2011-03-03 17:22:06 +00:00
Ted Kremenek 916c8357db Add coverage test for CFGImplicitDtor::getDestructorDecl() when handling typedefs.
llvm-svn: 126947
2011-03-03 17:07:11 +00:00
Douglas Gregor e29139c77d Eliminate redundant nested-name-specifiers on
TemplateSpecializationTypes, which also fixes PR9388.

llvm-svn: 126946
2011-03-03 17:04:51 +00:00
Abramo Bagnara 66a35d765f Removed left brace location from LinkageSpecDecl.
llvm-svn: 126945
2011-03-03 16:52:29 +00:00
Abramo Bagnara 4a8cda8556 Fixed end source location for LinkageSpecDecl.
llvm-svn: 126943
2011-03-03 14:52:38 +00:00
Abramo Bagnara 348823aa36 Fixed source range for FileScopeAsmDecl. Others source range fixes will follow.
llvm-svn: 126939
2011-03-03 14:20:18 +00:00
Douglas Gregor 739b107af8 When we use the default template arguments of a template template
parameter, save the instantiated default template arguments along with
the explicitly-specified template argument list. That way, we prefer
the default template template arguments corresponding to the template
template parameter rather than those of its template template argument.

This addresses the likely direction of C++ core issue 150, and fixes
PR9353/<rdar://problem/9069136>, bringing us closer to the behavior of
EDG and GCC.

llvm-svn: 126920
2011-03-03 02:41:12 +00:00
Douglas Gregor ce449ab16e Add a missing break, from John Wiegley
llvm-svn: 126919
2011-03-03 02:20:19 +00:00
Ted Kremenek 8cfe207861 Teach CFGImplicitDtor::getDestructorDecl() about arrays of objects with destructors.
llvm-svn: 126910
2011-03-03 01:21:32 +00:00
Ted Kremenek 1676a042e3 Teach CFGImplicitDtor::getDestructorDecl() about reference types.
llvm-svn: 126909
2011-03-03 01:01:03 +00:00
Matt Beaumont-Gay 86b900baca Let's go with John and Ted's preferred fix.
llvm-svn: 126907
2011-03-03 00:48:05 +00:00
Matt Beaumont-Gay 0532897f37 Keep GCC from complaining about falling off the end of the function.
llvm-svn: 126897
2011-03-02 23:25:06 +00:00
Dan Gohman 6ca9982757 Fix a typo.
llvm-svn: 126890
2011-03-02 22:39:34 +00:00
Douglas Gregor 978d07a5d7 Remove cruft
llvm-svn: 126888
2011-03-02 21:57:24 +00:00
Douglas Gregor 6471db0749 Force CaseStmt to store its child statements in source-code order,
which is important for libclang's token-annotation and
where's-my-cursor functionality. Fixes <rdar://problem/9004439>.

llvm-svn: 126887
2011-03-02 21:45:00 +00:00
Tilmann Scheller 99cc30c371 Revert "Add CC_Win64ThisCall and set it in the necessary places."
This reverts commit 126863.

llvm-svn: 126886
2011-03-02 21:36:49 +00:00
Rafael Espindola c4eb31e5e5 Apply sysroot to system c++ headers too. Fixes PR9372.
llvm-svn: 126884
2011-03-02 21:30:07 +00:00
Benjamin Kramer 0f074df979 Only emit string initializers in-place if types match. Fixes PR9373.
llvm-svn: 126883
2011-03-02 21:27:44 +00:00
Douglas Gregor 25b7e05b72 Fix the source range for a member access expression that includes a
nested-name-specifier and improve the detection of implicit 'this'
bases. Fixes <rdar://problem/8750392>.

llvm-svn: 126880
2011-03-02 21:06:53 +00:00
John McCall fb55f851a5 Work around a misdesigned GCC warning.
llvm-svn: 126879
2011-03-02 21:01:41 +00:00
Tilmann Scheller e60baf731b Revert "Add preliminary support for MSVC-style vtables."
This reverts commit 126865.

llvm-svn: 126876
2011-03-02 20:40:50 +00:00
Ted Kremenek e06a55c6b9 Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.
llvm-svn: 126875
2011-03-02 20:32:29 +00:00
Devang Patel bd6f7f9770 revert r126858.
llvm-svn: 126874
2011-03-02 20:31:22 +00:00
Fariborz Jahanian ff9890302c IRGen. Fix IR when message returns reference type.
// rdar://8604515.

llvm-svn: 126869
2011-03-02 20:09:49 +00:00
Tilmann Scheller a6c995dbb2 Add preliminary support for MSVC-style vtables.
llvm-svn: 126865
2011-03-02 19:38:28 +00:00
Tilmann Scheller 454464b491 Add CC_Win64ThisCall and set it in the necessary places.
llvm-svn: 126863
2011-03-02 19:36:23 +00:00
Douglas Gregor 64f38ae7ee Teach libclang how to visit the children of a C++ base-class specifier
(i.e., the TypeLoc describing the base class type).

llvm-svn: 126861
2011-03-02 19:17:03 +00:00
Devang Patel 31e5fb52d1 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

Reapply r126795 with a fix (one character change) for gdb testsuite regressions.

llvm-svn: 126858
2011-03-02 19:11:22 +00:00
Douglas Gregor cf256c1297 Eliminate an unnecessary TemporaryBase object from TreeTransform
llvm-svn: 126857
2011-03-02 19:02:55 +00:00