summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename FunctionDecl::isInline/setInline toDouglas Gregor2009-10-271-4/+4
| | | | | | FunctionDecl::isInlineSpecified/setInlineSpecified. llvm-svn: 85305
* Explicit instantiation suppresses the instantiation of non-inlineDouglas Gregor2009-10-271-0/+54
| | | | | | | function template specializations and member functions of class template specializations. llvm-svn: 85300
* An explicit instantiation definition only instantiations those classDouglas Gregor2009-10-271-0/+13
| | | | | | | | | members that have a definition. Also, use CheckSpecializationInstantiationRedecl as part of this instantiation to make sure that we diagnose the various kinds of problems that can occur with explicit instantiations. llvm-svn: 85270
* Preserve type source information in TypedefDecls. Preserve it acrossJohn McCall2009-10-241-3/+3
| | | | | | | | | template instantiation. Preserve it through PCH. Show it off to the indexer. I'm healthily ignoring the vector type cases because we don't have a sensible TypeLoc implementation for them anyway. llvm-svn: 84994
* Remove OriginalTypeParmDecl; the original type is the one specifiedJohn McCall2009-10-231-15/+0
| | | | | | | | | | | | | in the DeclaratorInfo, if one is present. Preserve source information through template instantiation. This is made more complicated by the possibility that ParmVarDecls don't have DIs, which is possibly worth fixing in the future. Also preserve source information for function parameters in ObjC method declarations. llvm-svn: 84971
* Move clients to use IdentifierInfo::getNameStart() instead of getName()Daniel Dunbar2009-10-181-1/+3
| | | | llvm-svn: 84436
* Clone the full Type hierarchy into the TypeLoc hierarchy. NormalizeJohn McCall2009-10-181-2/+9
| | | | | | | | | | | | | TypeLoc class names to be $(Type classname)Loc. Rewrite the visitor. Provide skeleton implementations for all the new TypeLocs. Handle all cases in PCH. Handle a few more cases when inserting location information in SemaType. It should be extremely straightforward to add new location information to existing TypeLoc objects now. llvm-svn: 84386
* Simplify checking of explicit template specialization/explicitDouglas Gregor2009-10-151-6/+32
| | | | | | | | | instantiation redeclaration semantics for function template specializations and member functions of class template specializations. Also, record the point of instantiation for explicit-instantiated functions and static data members. llvm-svn: 84188
* Give explicit and implicit instantiations of static data members ofDouglas Gregor2009-10-141-3/+18
| | | | | | | | class templates the proper linkage. Daniel, please look over the CodeGenModule bits. llvm-svn: 84140
* Testing and some minor fixes for explicit template instantiation.Douglas Gregor2009-10-141-1/+1
| | | | llvm-svn: 84129
* When explicitly specializing a member that is a template, mark theDouglas Gregor2009-10-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Diagnose the declaration of explicit specializations after an implicitDouglas Gregor2009-10-121-6/+11
| | | | | | | instantiation has already been required. To do so, keep track of the point of instantiation for anything that can be instantiated. llvm-svn: 83890
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-0/+3
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* For instantiations of static data members of class templates, keepDouglas Gregor2009-10-081-1/+20
| | | | | | | | track of the kind of specialization or instantiation. Also, check the scope of the specialization and ensure that a specialization declaration without an initializer is not a definition. llvm-svn: 83533
* Keep track of whether a member function instantiated from a memberDouglas Gregor2009-10-071-20/+46
| | | | | | | | | function of a class template was implicitly instantiated, explicitly instantiated (declaration or definition), or explicitly specialized. The same MemberSpecializationInfo structure will be used for static data members and member classes as well. llvm-svn: 83509
* -Introduce TypeLoc::getOpaqueData()Argyrios Kyrtzidis2009-09-291-1/+1
| | | | | | -Make TypeLoc's constructor public. llvm-svn: 83088
* Fix http://llvm.org/PR5090.Mike Stump2009-09-291-0/+4
| | | | llvm-svn: 83035
* WIP implementation of explicit function template specialization. ThisDouglas Gregor2009-09-241-4/+18
| | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 82728
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-1/+1
| | | | | | | | | | | 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. llvm-svn: 82501
* Rework the way we determine whether an externally visible symbol isDouglas Gregor2009-09-131-18/+57
| | | | | | | | generated for an inline function definition, taking into account C99 and GNU inline/extern inline semantics. This solution is simpler, cleaner, and fixes PR4536. llvm-svn: 81670
* Remove unnecessary ASTContext parameter from FunctionDecl::isBuiltinIDDouglas Gregor2009-09-121-1/+2
| | | | llvm-svn: 81590
* Remove unnecessary ASTContext parameters from isMain and isExternCDouglas Gregor2009-09-121-3/+6
| | | | llvm-svn: 81589
* Eliminate FunctionDecl::getBodyIfAvailableDouglas Gregor2009-09-121-10/+0
| | | | llvm-svn: 81588
* Tweak the semantics of FunctionDecl::isOutOfLine to consider anDouglas Gregor2009-09-111-0/+24
| | | | | | | | | | instantiation of a member function template or member function of a class template to be out-of-line if the definition of that function template or member function was defined out-of-line. This ensures that we get the correct linkage for explicit instantiations of out-of-line definitions. llvm-svn: 81562
* Cleanup and test C++ default arguments. Improvements include:Douglas Gregor2009-09-111-6/+16
| | | | | | | | | | | - Diagnose attempts to add default arguments to templates (or member functions of templates) after the initial declaration (DR217). - Improve diagnostics when a default argument is redefined. Now, the note will always point at the place where the default argument was previously defined, rather than pointing to the most recent declaration of the function. llvm-svn: 81548
* When stringizing a NamedDecl for a diagnostic, treat the templateJohn McCall2009-09-111-0/+12
| | | | | | specialization types differently. llvm-svn: 81512
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-46/+46
| | | | llvm-svn: 81346
* Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam ↵Anders Carlsson2009-09-081-3/+5
| | | | | | Weinig! llvm-svn: 81237
* Improve the AST representation and semantic analysis for externDouglas Gregor2009-09-041-12/+23
| | | | | | | | | | | templates. We now distinguish between an explicit instantiation declaration and an explicit instantiation definition, and know not to instantiate explicit instantiation declarations. Unfortunately, there is some remaining confusion w.r.t. instantiation of out-of-line member function definitions that causes trouble here. llvm-svn: 81053
* Correctly handle elaborated template ids. Still not handled properly for ↵John McCall2009-09-041-0/+12
| | | | | | friends. llvm-svn: 80977
* Remove TypeSpecStartLocation from VarDecl/FunctionDecl/FieldDecl, and use ↵Argyrios Kyrtzidis2009-08-211-9/+16
| | | | | | DeclaratorInfo to get this information. llvm-svn: 79584
* Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema ↵Argyrios Kyrtzidis2009-08-191-13/+15
| | | | | | | | | | | | interfaces. DeclaratorDecl contains a DeclaratorInfo* to keep type source info. Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl. EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo. Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet. llvm-svn: 79392
* Introduce DeclaratorInfo and TypeLoc, intended to be used for storing and ↵Argyrios Kyrtzidis2009-08-191-0/+5
| | | | | | | | | | | reading source information for types. DeclaratorInfo will contain a flat memory block for source information about a type that came out of a declarator. TypeLoc and its subclasses will be used by clients as wrappers to "traverse" the memory block and read the information. Both DeclaratorInfo and TypeLoc are not utilized in this commit. llvm-svn: 79391
* Disable all recognition of main() in -ffreestanding. Addresses bug #4720.John McCall2009-08-151-2/+3
| | | | llvm-svn: 79070
* There's no point in going through the getAs<TagType> stuff to find the ↵Douglas Gregor2009-07-291-3/+0
| | | | | | definition of a tag, since tags rarely have more than one or two declarations llvm-svn: 77546
* Make tag declarations redeclarable. This change has three purposes:Douglas Gregor2009-07-291-21/+27
| | | | | | | | | | | | | | | | 1) Allow the Index library (and any other interested client) to walk the set of declarations for a given tag (enum, union, class, whatever). At the moment, this information is not readily available. 2) Reduce our dependence on TagDecl::TypeForDecl being mapped down to a TagType (for which getDecl() will return the tag definition, if one exists). This property won't exist for class template partial specializations. 3) Make the canonical declaration of a TagDecl actually canonical, e.g., so that it does not change when the tag is defined. llvm-svn: 77523
* Change uses of:Ted Kremenek2009-07-291-6/+6
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Template instantiation for static data members that are defined out-of-line.Douglas Gregor2009-07-241-0/+4
| | | | | | | | Note that this also fixes a bug that affects non-template code, where we were not treating out-of-line static data members are "file-scope" variables, and therefore not checking their initializers. llvm-svn: 77002
* Add the location of the tag keyword into TagDecl. From EneaDouglas Gregor2009-07-211-7/+7
| | | | | | Zaffanella, with tweaks from Abramo Bagnara. llvm-svn: 76576
* Introduce a redecl_iterator in Decl class, so that we can do a "iterate over ↵Argyrios Kyrtzidis2009-07-181-1/+1
| | | | | | all declarations of the same decl" without knowing the exact type. llvm-svn: 76298
* Introduce the Redeclarable template class, which serves as a base type ↵Argyrios Kyrtzidis2009-07-181-42/+4
| | | | | | | | defining the common interface for Decls that can be redeclared. Make FunctionDecl and VarDecl use it. llvm-svn: 76297
* Remove getFirstDeclaration/getLatestDeclaration from FunctionDecl and VarDecl.Argyrios Kyrtzidis2009-07-181-18/+4
| | | | | | Their usefulness is questionable since redecl_iterator was introduced. llvm-svn: 76275
* Move the functionality of ASTContext::getCanonicalDecl(), into a virtual ↵Argyrios Kyrtzidis2009-07-181-4/+18
| | | | | | method Decl::getCanonicalDecl(). llvm-svn: 76273
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-6/+6
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-6/+6
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.Steve Naroff2009-07-141-2/+2
| | | | | Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary). llvm-svn: 75635
* Introduce redecl_iterator, used for iterating over the redeclarations of a ↵Argyrios Kyrtzidis2009-07-141-19/+19
| | | | | | | | | | | | | | | | | | | | | FunctionDecl or VarDecl. It iterates over all the redeclarations, regardless of the starting point. For example: 1) int f(); 2) int f(); 3) int f(); if you have the (2) FunctionDecl and call redecls_begin/redecls_end to iterate, you'll get this sequence: (2) (1) (3) The motivation to introduce this was that, previously, if (3) was a function definition, and you called getBody() at (2), it would not return it, since getBody() iterated over the previous declarations only, so it would only check (2) and (1). llvm-svn: 75604
* Introduce FunctionDecl::getLatestDeclaration() and ↵Argyrios Kyrtzidis2009-07-141-7/+39
| | | | | | | | | | VarDecl::getLatestDeclaration(). For multiple redeclarations they return the last one. Also, add some non const versions of methods. llvm-svn: 75603
* Introduce FunctionDecl::getFirstDeclaration() and ↵Argyrios Kyrtzidis2009-07-141-10/+18
| | | | | | | | VarDecl::getFirstDeclaration(). For multiple redeclarations they return the first one. llvm-svn: 75602
* Add the SourceLocation for the right brace in TagDecl.Argyrios Kyrtzidis2009-07-141-0/+5
| | | | llvm-svn: 75590
OpenPOWER on IntegriCloud