|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| ... |  | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | - When instantiating a friend type template, perform semantic
  analysis on the resulting type.
  - Downgrade the errors concerning friend type declarations that do
  not refer to classes to ExtWarns in C++98/03. C++0x allows
  practically any type to be befriended, and ignores the friend
  declaration if the type is not a class.
llvm-svn: 100635 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | nested-name-specifier (e.g., "class T::foo") fails to find a tag
member in the scope nominated by the
nested-name-specifier. Previously, we gave a bland
  error: 'Nested' does not name a tag member in the specified scope
which didn't actually say where we were looking, which was rather
horrible when the nested-name-specifier was instantiated. Now, we give
something a bit better:
  error: no class named 'Nested' in 'NoDepBase<T>'
llvm-svn: 100060 | 
| | 
| 
| 
| 
| 
| 
| 
| | This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920 | 
| | 
| 
| 
| | llvm-svn: 99708 | 
| | 
| 
| 
| 
| 
| | lexical context.  This is required for ADL to work properly;  fixes PR6716.
llvm-svn: 99665 | 
| | 
| 
| 
| 
| 
| | pattern if it has a body.
llvm-svn: 99610 | 
| | 
| 
| 
| | llvm-svn: 99601 | 
| | 
| 
| 
| | llvm-svn: 99596 | 
| | 
| 
| 
| | llvm-svn: 99525 | 
| | 
| 
| 
| 
| 
| 
| | the redeclaration chain.  Recommitted from r99477 with a fix:  we need to
merge in default template arguments from previous declarations.
llvm-svn: 99496 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | buildbot.  The tramp3d test fails.
--- Reverse-merging r99477 into '.':
U    test/SemaTemplate/friend-template.cpp
U    test/CXX/temp/temp.decls/temp.friend/p1.cpp
U    lib/Sema/SemaTemplateInstantiateDecl.cpp
U    lib/Sema/SemaAccess.cpp
llvm-svn: 99481 | 
| | 
| 
| 
| | llvm-svn: 99477 | 
| | 
| 
| 
| 
| 
| 
| | not pick apart a CXXTemporaryObjectExpr because such an object
construction was explicitly written in the source code. Fixes PR6657.
llvm-svn: 99427 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | templates.  So delay access-control diagnostics when (for example) the target
of a friend declaration is a specific specialization of a template.
I was surprised to find that this was required for an access-controlled selfhost.
llvm-svn: 99383 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | on unqualified declarations.
Patch by Enea Zaffanella!  Minimal adjustments:  allocate the ExtInfo nodes
with the ASTContext and delete them during Destroy().  I audited a bunch of
Destroy methods at the same time, to ensure that the correct teardown was
being done.
llvm-svn: 98540 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | instantiation.  Based on a patch by Enea Zaffanella!  I found a way to
reduce some of the redundancy between TreeTransform's "standard"
FunctionProtoType transformation and TemplateInstantiator's override,
and I killed off the old SubstFunctionType by adding type source info
for the last cases where we were creating FunctionDecls without TSI
(at least that get passed through template instantiation).
llvm-svn: 98252 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | injected class name of a class template or class template partial specialization.
This is a non-canonical type;  the canonical type is still a template 
specialization type.  This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but
whatever).
Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.     
llvm-svn: 98134 | 
| | 
| 
| 
| 
| 
| | base/member initializers.
llvm-svn: 97560 | 
| | 
| 
| 
| 
| 
| | redeclarations. Fixes PR6449
llvm-svn: 97478 | 
| | 
| 
| 
| 
| 
| 
| | enumeration constants get placed into the local instantiation hash
table. Fixes PR6375.
llvm-svn: 97471 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | template definition. Do this both by being more tolerant of errors in
our asserts and by not dropping a variable declaration completely when
its initializer is ill-formed. Fixes the crash-on-invalid in PR6375,
but not the original issue.
llvm-svn: 97463 | 
| | 
| 
| 
| 
| 
| 
| | given declaration in a template, make sure that the context we're
searching through is complete. Fixes PR6376.
llvm-svn: 97444 | 
| | 
| 
| 
| 
| 
| | disaster. Fixes PR6161.
llvm-svn: 96371 | 
| | 
| 
| 
| | llvm-svn: 96335 | 
| | 
| 
| 
| 
| 
| | redeclaration provides an explicit instantiation or is invalid.
llvm-svn: 96097 | 
| | 
| 
| 
| 
| 
| | Decl subclasses. No functionality change.
llvm-svn: 95841 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Sema::ActOnUninitializedDecl over to InitializationSequence (with
default initialization), eliminating redundancy. More importantly, we
now check that a const definition in C++ has an initilizer, which was
an #if 0'd code for many, many months. A few other tweaks were needed
to get everything working again:
  - Fix all of the places in the testsuite where we defined const
    objects without initializers (now that we diagnose this issue)
  - Teach instantiation of static data members to find the previous
    declaration, so that we build proper redeclaration
    chains. Previously, we had the redeclaration chain but built it
    too late to be useful, because...
  - Teach instantiation of static data member definitions not to try
    to check an initializer if a previous declaration already had an
    initializer. This makes sure that we don't complain about static
    const data members with in-class initializers and out-of-line
    definitions.
  - Move all of the incomplete-type checking logic out of
    Sema::FinalizeDeclaratorGroup; it makes more sense in
    ActOnUnitializedDecl.
There may still be a few places where we can improve these
diagnostics. I'll address that as a separate commit.
llvm-svn: 95657 | 
| | 
| 
| 
| | llvm-svn: 95517 | 
| | 
| 
| 
| 
| 
| | PR 5517.
llvm-svn: 95470 | 
| | 
| 
| 
| 
| 
| 
| 
| | type-checking within a template definition. In this case, the
"instantiated" declaration is just the declaration itself, found
within the current instantiation. Fixes PR6239.
llvm-svn: 95442 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | when instantiating the declaration of a member template:
  - Only check if the have a template template argument at a specific position
  when we already know that we have template arguments at that level;
  otherwise, we're substituting for a level-reduced template template
  parameter. 
  - When trying to find an instantiated declaration for a template
  template parameter, look into the instantiated scope. This was a
  typo, where we had two checks for TemplateTypeParmDecl, one of
  which should have been a TemplateTemplateParmDecl.
With these changes, tramp3d-v4 passes -fsyntax-only.
llvm-svn: 95421 | 
| | 
| 
| 
| 
| 
| | initializer. Grrr....
llvm-svn: 95211 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | (necessarily simultaneous) changes:
  - CXXBaseOrMemberInitializer now contains only a single initializer
    rather than a set of initialiation arguments + a constructor. The
    single initializer covers all aspects of initialization, including
    constructor calls as necessary but also cleanup of temporaries
    created by the initializer (which we never handled
    before!).
  - Rework + simplify code generation for CXXBaseOrMemberInitializers,
    since we can now just emit the initializer as an initializer.
  - Switched base and member initialization over to the new
    initialization code (InitializationSequence), so that it
  - Improved diagnostics for the new initialization code when
    initializing bases and members, to match the diagnostics produced
    by the previous (special-purpose) code.
  - Simplify the representation of type-checked constructor initializers in
    templates; instead of keeping the fully-type-checked AST, which is
    rather hard to undo at template instantiation time, throw away the
    type-checked AST and store the raw expressions in the AST. This
    simplifies instantiation, but loses a little but of information in
    the AST.
  - When type-checking implicit base or member initializers within a
    dependent context, don't add the generated initializers into the
    AST, because they'll look like they were explicit.
  - Record in CXXConstructExpr when the constructor call is to
  initialize a base class, so that CodeGen does not have to infer it
  from context. This ensures that we call the right kind of
  constructor.
There are also a few "opportunity" fixes here that were needed to not
regress, for example:
  - Diagnose default-initialization of a const-qualified class that
    does not have a user-declared default constructor. We had this
    diagnostic specifically for bases and members, but missed it for
    variables. That's fixed now.
  - When defining the implicit constructors, destructor, and
    copy-assignment operator, set the CurContext to that constructor
    when we're defining the body.
llvm-svn: 94952 | 
| | 
| 
| 
| | llvm-svn: 94333 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | translation unit.  This is temporary for function and block parameters;
template parameters can just stay this way, since Templates aren't
DeclContexts.  This gives us the nice property that everything created
in a record DC should have access in C++.
llvm-svn: 94122 | 
| | 
| 
| 
| 
| 
| 
| 
| | Triggers lots of assertions about missing access information;  fix them.
Will actually consume this information soon.
llvm-svn: 94038 | 
| | 
| 
| 
| | llvm-svn: 93726 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | which are instantiations of the member functions of local
classes. These implicit instantiations have to occur at the same time
as---and in the same local instantiation scope as---the enclosing
function, since the member functions of the local class can refer to
locals within the enclosing function. This should really, really fix PR5764.
llvm-svn: 93666 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | to merge the local instantiation scope with the outer local
instantiation scope, so that we can instantiate declarations from the
function owning the local class. Fixes an assert while instantiating
Boost.MPL's BOOST_MPL_ASSERT_MSG.
llvm-svn: 93651 | 
| | 
| 
| 
| 
| 
| | the AST lest we run into some crazy canonicalization bug like PR5874.
llvm-svn: 92283 | 
| | 
| 
| 
| 
| 
| 
| 
| | keep track of friends within templates, which will provide a real for
PR5866. For now, this makes sure we don't do something entirely stupid
with friends of specializations.
llvm-svn: 92143 | 
| | 
| 
| 
| | llvm-svn: 91928 | 
| | 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | This test courtesy of LLVM.
llvm-svn: 91462 | 
| | 
| 
| 
| 
| 
| | I apologize for friend declarations.
llvm-svn: 91359 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | - During instantiation, drop default arguments from constructor and
    call expressions; they'll be recomputed anyway, and we don't want
    to instantiate them twice.
  - Rewrote the instantiation of variable initializers to cope with
    non-dependent forms properly.
Together, these fix a handful of problems I introduced with the switch
to always rebuild expressions from the source code "as written."
llvm-svn: 91315 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | implicitly-generated AST nodes. We previously built instantiated nodes
for each of these AST nodes, then passed them on to Sema, which was
not prepared to see already-type-checked nodes (see PR5755). In some
places, we had ugly workarounds to try to avoid re-type-checking
(e.g., in VarDecl initializer instantiation).
Now, we skip implicitly-generated nodes when performing instantiation,
preferring instead to build just the AST nodes that directly reflect
what was written in the source code. This has several advantages:
  - We don't need to instantiate anything that doesn't have a direct
    correlation to the source code, so we can have better location
    information.
  - Semantic analysis sees the same thing at template instantiation
    time that it would see for a non-template.
  - At least one ugly hack (VarDecl initializers) goes away.
Fixes PR5755.
llvm-svn: 91218 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | declarations.  There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not.  In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.
llvm-svn: 91045 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | print exception specifications on function types and
declarations. Fixes <rdar://problem/7450999>.
There is some poor source-location information here, because we don't
track locations of the types in exception specifications. Filed PR5719.
Failures during template instantiation of the signature of a function
or function template have wrong point-of-instantiation location
information. I'll tackle that with a separate commit.
llvm-svn: 90863 | 
| | 
| 
| 
| 
| 
| | declarations.
llvm-svn: 90843 |