summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-1/+8
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Unify the way destructor epilogues are generated for synthesized and regular ↵Anders Carlsson2009-11-171-1/+1
| | | | | | destructors. Also fix PR5529. llvm-svn: 89034
* Carry lookup configuration throughout lookup on the LookupResult. GiveJohn McCall2009-11-171-36/+44
| | | | | | | | | | | | | LookupResult RAII powers to diagnose ambiguity in the results. Other diagnostics (e.g. access control and deprecation) will be moved to automatically trigger during lookup as part of this same mechanism. This abstraction makes it much easier to encapsulate aliasing declarations (e.g. using declarations) inside the lookup system: eventually, lookup will just produce the aliases in the LookupResult, and the standard access methods will naturally strip the aliases off. llvm-svn: 89027
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Make sure that virtual destructors have delete operators.Anders Carlsson2009-11-151-2/+9
| | | | llvm-svn: 88877
* Deallocation functions must also be static.Anders Carlsson2009-11-151-1/+7
| | | | llvm-svn: 88859
* allocation functions are always static.Anders Carlsson2009-11-151-1/+10
| | | | llvm-svn: 88858
* If any errors have occurred by the time we hit the end of a function body, ↵Douglas Gregor2009-11-151-0/+6
| | | | | | clear out any remaining temporaries so they aren't seen later. llvm-svn: 88834
* Fix for PR5489: don't skip the complete type requrirement for variableEli Friedman2009-11-141-2/+7
| | | | | | definitions just because the type happens to be an array type. llvm-svn: 88752
* Revert r88718, which does NOT solve the ↵Douglas Gregor2009-11-131-3/+0
| | | | | | constructor-template-as-copy-constructor issue. Big thanks to John for finding this llvm-svn: 88724
* A constructor template cannot be instantiated to a copyDouglas Gregor2009-11-131-0/+3
| | | | | | constructor. Make sure that such declarations can never be formed. llvm-svn: 88718
* Fix bug Doug noticed.Anders Carlsson2009-11-131-0/+2
| | | | llvm-svn: 88679
* Random const correctness, and incidentally use computeDeclContext when buildingJohn McCall2009-11-121-1/+1
| | | | | | a using declaration. llvm-svn: 86942
* Improve parsing of template arguments to lay the foundation forDouglas Gregor2009-11-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | handling template template parameters properly. This refactoring: - Parses template template arguments as id-expressions, representing the result of the parse as a template name (Action::TemplateTy) rather than as an expression (lame!). - Represents all parsed template arguments via a new parser-specific type, ParsedTemplateArgument, which stores the kind of template argument (type, non-type, template) along with all of the source information about the template argument. This replaces an ad hoc set of 3 vectors (one for a void*, which was either a type or an expression; one for a bit telling whether the first was a type or an expression; and one for a single source location pointing at the template argument). - Moves TemplateIdAnnotation into the new Parse/Template.h. It never belonged in the Basic library anyway. llvm-svn: 86708
* Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass ofDouglas Gregor2009-11-091-1/+1
| | | | | | | ArrayType>()) does not instantiate. Update all callers that used this unsafe feature to use the appropriate ASTContext::getAs*ArrayType method. llvm-svn: 86596
* When checking the namespace of a redeclaration or definition, look through ↵Sebastian Redl2009-11-081-11/+16
| | | | | | linkage specs. Fixes PR5430. llvm-svn: 86461
* Don't treat variables with non-trivial ctors or dtors as unused. Fixes PR5407.Anders Carlsson2009-11-071-2/+16
| | | | llvm-svn: 86352
* Cleanup, no functionality change.Anders Carlsson2009-11-071-4/+8
| | | | llvm-svn: 86351
* Make sure that EnumConstantDecls always get a type, even when they have ↵Douglas Gregor2009-11-061-14/+20
| | | | | | type-dependent initializers. llvm-svn: 86197
* Don't allow definitions of array variables without some size information in ↵Sebastian Redl2009-11-051-0/+10
| | | | | | C++. Fixed PR5401 llvm-svn: 86165
* Change our basic strategy for avoiding deprecation warnings when the decl useJohn McCall2009-11-041-1/+4
| | | | | | | | | | | | appears in a deprecated context. In the new strategy, we emit the warnings as usual unless we're currently parsing a declaration, where "declaration" is restricted to mean a decl group or a few special cases in Objective C. If we *are* parsing a declaration, we queue up the deprecation warnings until the declaration has been completely parsed, and then emit them only if the decl is not deprecated. We also standardize the bookkeeping for deprecation so as to avoid special cases. llvm-svn: 85998
* Use ParseUnqualifiedId when parsing id-expressions. This eliminatesDouglas Gregor2009-11-031-43/+47
| | | | | | | | | | | yet another copy of the unqualified-id parsing code. Also, use UnqualifiedId to simplify the Action interface for building id-expressions. ActOnIdentifierExpr, ActOnCXXOperatorFunctionIdExpr, ActOnCXXConversionFunctionExpr, and ActOnTemplateIdExpr have all been removed in favor of the new ActOnIdExpression action. llvm-svn: 85904
* Introduce a new class, UnqualifiedId, that provides a parsedDouglas Gregor2009-11-031-34/+37
| | | | | | | | | | | | | | | | representation of a C++ unqualified-id, along with a single parsing function (Parser::ParseUnqualifiedId) that will parse all of the various forms of unqualified-id in C++. Replace the representation of the declarator name in Declarator with the new UnqualifiedId class, simplifying declarator-id parsing considerably and providing more source-location information to Sema. In the future, I hope to migrate all of the other unqualified-id-parsing code over to this single representation, then begin to merge actions that are currently only different because we didn't have a unqualified notion of the name in the parser. llvm-svn: 85851
* Make sure to call CompleteConstructorCall for bases and members that are ↵Anders Carlsson2009-10-291-0/+3
| | | | | | initialized implicitly in constructors so that default arguments etc are set correctly. Fixes PR5283. llvm-svn: 85510
* Track source information for template arguments and template specializationJohn McCall2009-10-291-1/+1
| | | | | | | types. Preserve it through template instantiation. Preserve it through PCH, although TSTs themselves aren't serializable, so that's pretty much meaningless. llvm-svn: 85500
* Use array's base element type in getting to itsFariborz Jahanian2009-10-281-1/+1
| | | | | | constructor. WIP. llvm-svn: 85420
* Removed an unnecessary arguement passed to InitializeVarWithConstructorFariborz Jahanian2009-10-281-1/+1
| | | | | | | which should come from the variable and wasn't correct for arrays in any case. No change in functionality. llvm-svn: 85415
* Rename FunctionDecl::isInline/setInline toDouglas Gregor2009-10-271-1/+1
| | | | | | FunctionDecl::isInlineSpecified/setInlineSpecified. llvm-svn: 85305
* Almost missed this one... Doc update for last change.Mike Stump2009-10-271-4/+5
| | | | llvm-svn: 85196
* Refine noreturn handling. Fixes -Wmissing-noreturn so that it doesn'tMike Stump2009-10-271-5/+14
| | | | | | | complain that functions that have a return statement should be declared noreturn. Fixed PR5286. llvm-svn: 85195
* Use a pred_iterator instead of a succ_iterator (wrong typedef).Ted Kremenek2009-10-271-1/+1
| | | | llvm-svn: 85193
* Fix PR5298 - -Wmissing-noreturn shouldn't warn if the function is alreadyChris Lattner2009-10-251-2/+3
| | | | | | declared noreturn. llvm-svn: 85075
* Make sure we actually have a definition before asking if it is implicit. ↵Sebastian Redl2009-10-251-2/+6
| | | | | | Fixes PR4674. llvm-svn: 85072
* When parsing a top level struct declaration, make sure to Chris Lattner2009-10-251-3/+4
| | | | | | | | | process decl attributes instead of dropping them on the floor. This allows us to diagnose cases like the testcase. Also don't diagnose deprecated stuff in ActOnTag: not all uses of tags may be 'uses', and SemaType does this now. llvm-svn: 85071
* move calls to DiagnoseUseOfDecl (which warns about deprecated/unavailable Chris Lattner2009-10-251-8/+1
| | | | | | | | types) out of Sema::getTypeName into ConvertDeclSpecToType. getTypeName is sometimes used as a predicate in the parser, so it could cause redundant diags to be emitted. This is also needed by two upcoming enhancements. llvm-svn: 85070
* Remove the Skip parameter from GetTypeForDeclarator and dependents. Take the ↵Sebastian Redl2009-10-251-2/+1
| | | | | | opportunity to improve an error message and fix PR4498. llvm-svn: 85068
* simplify Sema::getTypeName a bit: if control gets out of the switch,Chris Lattner2009-10-251-34/+30
| | | | | | | IIDecl cannot be null. There is no need to check for both C++ mode and presence of CXXRecordDecl. ObjC interfaces can't have ScopeSpecs. llvm-svn: 85057
* In objc mode, every identifier in a cast expression was using doing aChris Lattner2009-10-251-1/+1
| | | | | | | | | | type looking using getTypeName() and every property access was using NextToken() to do lookahead to see if the identifier is followed by a '.'. Rearrange this code to not need lookahead and only do the type lookup if we have "identifier." in the token stream. Also improve a diagnostic a bit. llvm-svn: 85056
* Audit the code for places where it is assumed that every base specifier ↵Sebastian Redl2009-10-251-1/+1
| | | | | | refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector. llvm-svn: 85055
* Preserve type source information in TypedefDecls. Preserve it acrossJohn McCall2009-10-241-7/+10
| | | | | | | | | 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-10/+3
| | | | | | | | | | | | | 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
* Preserve source information for anonymous struct/union declarations.John McCall2009-10-221-4/+8
| | | | llvm-svn: 84913
* Add FIXME.Ted Kremenek2009-10-201-0/+2
| | | | llvm-svn: 84696
* Remove default argument for ImpCastExprToType. Add appropriate argument Eli Friedman2009-10-201-2/+2
| | | | | | | | | | | | | to all callers. Switch a few other users of CK_Unknown to proper cast kinds. Note that there are still some situations where we end up with CK_Unknown; they're pretty easy to find with grep. There are still a few missing conversion kinds, specifically pointer/int/float->bool and the various combinations of real/complex float/int->real/complex float/int. llvm-svn: 84623
* PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar2009-10-181-3/+3
| | | | | | are updated. llvm-svn: 84447
* Move misc clients to IdentifierInfo StringRef API.Daniel Dunbar2009-10-181-4/+5
| | | | | | | | | - strcmp -> == - OS.write(II->getName() ...) -> OS << II->getNameStr() - Avoid std::string concatenation - Use getNameStr().str() when an std::string is really needed. llvm-svn: 84437
* In some dependent contexts, incomplete array types persist into ↵Sebastian Redl2009-10-171-4/+31
| | | | | | FinalizeDeclaratorGroup. Don't require them to have a complete type. This allows us to compile Hello World with the Apache stdcxx library. If you don't use endl, it even links and runs. llvm-svn: 84347
* Simplify.Daniel Dunbar2009-10-171-3/+1
| | | | llvm-svn: 84307
* Remove the ConstantArrayType subtypes. This information is preserved in theJohn McCall2009-10-161-10/+3
| | | | | | | | | | TypeLoc records for declarations; it should not be necessary to represent it directly in the type system. Please complain if you were using these classes and feel you can't replicate previous functionality using the TypeLoc API. llvm-svn: 84222
* Improve diagnostics when the parser encounters a declarator with anDouglas Gregor2009-10-131-0/+31
| | | | | | | | | | | | | | | | | | | | | | | unknown type name, e.g., foo::bar x; when "bar" does not refer to a type in "foo". With this change, the parser now calls into the action to perform diagnostics and can try to recover by substituting in an appropriate type. For example, this allows us to easily diagnose some missing "typename" specifiers, which we now do: test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename' prior to dependent type name 'A<T>::type' A<T>::type A<T>::f() { return type(); } ^~~~~~~~~~ typename Fixes PR3990. llvm-svn: 84053
OpenPOWER on IntegriCloud