summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix two typos in comments.Sebastian Redl2010-06-091-1/+1
| | | | llvm-svn: 105751
* When referring to a tag that was previously declared only as a friend, Douglas Gregor2010-06-081-1/+2
| | | | | | | build a new declaration for that tag type that will be visible for future lookups of that tag. llvm-svn: 105643
* Added AccessSpecDecl node.Abramo Bagnara2010-06-051-0/+2
| | | | llvm-svn: 105525
* Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.John McCall2010-06-041-10/+9
| | | | | | This is never null, but the associated type might be. llvm-svn: 105503
* Restructure how we interpret block-literal declarators. Correctly handleJohn McCall2010-06-041-8/+14
| | | | | | | the case where we pick up block arguments from a typedef. Save the block signature as it was written, and preserve same through PCH. llvm-svn: 105466
* Delay checking for mutable const fields until we're checking the field.John McCall2010-06-041-0/+18
| | | | | | | Allows this check to work properly for instantiated fields and removes an unnecessary GetTypeForDeclarator call. llvm-svn: 105463
* Sema: Replace getPragmaPackAlignment with AddAlignmentAttributesForRecord, whichDaniel Dunbar2010-05-271-8/+5
| | | | | | exposes less details. llvm-svn: 104797
* AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.Daniel Dunbar2010-05-271-1/+1
| | | | llvm-svn: 104795
* Improve on flexible array diagnostics (PR7029).Fariborz Jahanian2010-05-261-1/+1
| | | | llvm-svn: 104739
* Fixes misc. flexible array bugs in c++ (PR7029).Fariborz Jahanian2010-05-261-0/+9
| | | | llvm-svn: 104733
* Improve parser recovery when we encounter a dependent template nameDouglas Gregor2010-05-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is missing the 'template' keyword, e.g., t->getAs<T>() where getAs is a member of an unknown specialization. C++ requires that we treat "getAs" as a value, but that would fail to parse since T is the name of a type. We would then fail at the '>', since a type cannot be followed by a '>'. This is a very common error for C++ programmers to make, especially since GCC occasionally allows it when it shouldn't (as does Visual C++). So, when we are in this case, we use tentative parsing to see if the tokens starting at "<" can only be parsed as a template argument list. If so, we produce a diagnostic with a fix-it that states that the 'template' keyword is needed: test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword is required to treat 'getAs' as a dependent template name t->getAs<T>(); ^ template This is just a start of this patch; I'd like to apply the same approach to everywhere that a template-id with dependent template name can be parsed. llvm-svn: 104406
* Propagate access specifiers to anonymous union members nested within classes.John McCall2010-05-211-11/+20
| | | | | | Fixes <rdar://problem/7987650>. llvm-svn: 104376
* Whoops.John McCall2010-05-201-1/+1
| | | | llvm-svn: 104218
* Don't try to check jump scopes in invalid functions. FixesJohn McCall2010-05-201-1/+3
| | | | | | <rdar://problem/7995494>. llvm-svn: 104217
* Added basic source locations to Elaborated and DependentName types.Abramo Bagnara2010-05-191-2/+3
| | | | llvm-svn: 104169
* Adds support for ObjC++'s GC attribute on declaration ofFariborz Jahanian2010-05-191-3/+14
| | | | | | object variables and functions returning such objects. llvm-svn: 104168
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-4/+4
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-0/+35
| | | | | | | | | | | | return value optimization. Sema marks return statements with their NRVO candidates (which may or may not end up using the NRVO), then, at the end of a function body, computes and marks those variables that can be allocated into the return slot. I've checked this locally with some debugging statements (not committed), but there won't be any tests until CodeGen comes along. llvm-svn: 103865
* Patch to fix a crash on incomplete class declaration.Fariborz Jahanian2010-05-141-3/+7
| | | | | | Radar 7923673. llvm-svn: 103812
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-40/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-19/+20
| | | | llvm-svn: 103517
* Improve our handling of the -Wunused-variable warning in templates. InDouglas Gregor2010-05-081-15/+22
| | | | | | | | | particular, don't complain about unused variables that have dependent type until instantiation time, so that we can look at the type of the variable. Moreover, only complain about unused variables that have neither a user-declared constructor nor a non-trivial destructor. llvm-svn: 103362
* Remember the number of positive and negative bits used by the enumerators ofJohn McCall2010-05-061-2/+3
| | | | | | | an enum in the enum decl itself. Use some spare bits from TagDecl for this purpose. llvm-svn: 103173
* When instantiating a function that was declared via a typedef, e.g.,Douglas Gregor2010-05-041-2/+4
| | | | | | | | | | | | | typedef int functype(int, int); functype func; also instantiate the synthesized function parameters for the resulting function declaration. With this change, Boost.Wave builds and passes all of its regression tests. llvm-svn: 103025
* Diagnose unused exception parameters under a different warning groupDouglas Gregor2010-05-031-3/+8
| | | | | | | | (-Wunused-exception-parameter) than normal variables, since it's more common to name and then ignore an exception parameter. This warning is neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>. llvm-svn: 102931
* When a class contains a non-empty anonymous union or struct, mark isDouglas Gregor2010-05-031-2/+5
| | | | | | as non-empty. Fixes PR7021. llvm-svn: 102913
* It turns out that basically every caller to RequireCompleteDeclContextJohn McCall2010-05-011-4/+11
| | | | | | | already knows what context it's looking in. Just pass that context in instead of (questionably) recalculating it. llvm-svn: 102818
* Rebuild the nested name specifiers in member-pointer declarator chunks whenJohn McCall2010-04-291-56/+104
| | | | | | | | | entering the current instantiation. Set up a little to preserve type location information for typename types while we're in there. Fixes a Boost failure. llvm-svn: 102673
* Written storage class for declarations inside linkage specifications without ↵Abramo Bagnara2010-04-281-9/+29
| | | | | | braces is none. llvm-svn: 102496
* When checking the redeclaration context of a typedef that refers to aDouglas Gregor2010-04-271-1/+2
| | | | | | | tag of the same name, compare the lookup contexts rather than the actual contexts. Fixes PR6923. llvm-svn: 102437
* Don't look into incomplete types when trying to warn about unusedDouglas Gregor2010-04-271-0/+5
| | | | | | variables. Fixes PR6948. llvm-svn: 102436
* Diagnose declaration of reference typed ivars.Fariborz Jahanian2010-04-261-2/+5
| | | | llvm-svn: 102390
* CastExpr should not hold a pointer to the base path. More cleanup.Anders Carlsson2010-04-241-1/+1
| | | | llvm-svn: 102249
* Be more careful around dependent nested-name-specifiers, complainingDouglas Gregor2010-04-241-1/+1
| | | | | | | | when they are not complete (since we could not match them up to anything) and ensuring that enum parsing can cope with dependent elaborated-type-specifiers. Fixes PR6915 and PR6649. llvm-svn: 102247
* Keep track of when DependentNameTypes have no associated keywordDouglas Gregor2010-04-241-3/+2
| | | | | | | (e.g., no typename, enum, class, etc.), e.g., because the context is one that is known to refer to a type. Patch from Enea Zaffanella! llvm-svn: 102243
* Recommit r102215, this time being more careful to only set the "principalJohn McCall2010-04-241-6/+11
| | | | | | | declaration" (i.e. the only which will actually be looked up) to have the non-member-operator bit. llvm-svn: 102231
* Revert r102215. This causes clang crash while compiling a test case from gdb ↵Devang Patel2010-04-241-6/+0
| | | | | | testsuite. llvm-svn: 102224
* Rework Parser-Sema interface for Objective-C @catch exception objectDouglas Gregor2010-04-231-5/+0
| | | | | | | | | arguments. Rather than having the parser call ActOnParamDeclarator (which is a bit of a hack), call a new ActOnObjCExceptionDecl action. We'll be moving more functionality into this handler to perform earlier checking of @catch. llvm-svn: 102222
* Add an InheritancePath parameter to the ImplicitCastExpr constructor.Anders Carlsson2010-04-231-0/+1
| | | | llvm-svn: 102218
* Transition the last acceptable-result filter kind in LookupResult over to useJohn McCall2010-04-231-0/+6
| | | | | | a simple IDNS mask by introducing a namespace for non-member operators. llvm-svn: 102215
* Recommit my change to how C++ does elaborated type lookups, now withJohn McCall2010-04-231-34/+75
| | | | | | two bugfixes which fix selfhost and (hopefully) the nightly tests. llvm-svn: 102198
* Revert "C++ doesn't really use "namespaces" for different kinds of names the ↵Daniel Dunbar2010-04-231-71/+34
| | | | | | same", which seems to break most C++ nightly test apps. llvm-svn: 102174
* C++ doesn't really use "namespaces" for different kinds of names the sameJohn McCall2010-04-231-34/+71
| | | | | | | | | | | | | way that C does. Among other differences, elaborated type specifiers are defined to skip "non-types", which, as you might imagine, does not include typedefs. Rework our use of IDNS masks to capture the semantics of different kinds of declarations better, and remove most current lookup filters. Removing the last remaining filter is more complicated and will happen in a separate patch. Fixes PR 6885 as well some spectrum of unfiled bugs. llvm-svn: 102164
* When checking whether to diagnose an initialized "extern" variable,Douglas Gregor2010-04-221-1/+5
| | | | | | | look for the const on the base type rather than on the top-level type. Fixes PR6495 properly. llvm-svn: 102066
* Re-land the patch that merges two diagnostics into one now that it passes ↵Anders Carlsson2010-04-221-14/+9
| | | | | | self-host :) llvm-svn: 102050
* Revert "Unify two diagnostics into one.", it breaks with an assertion ↵Daniel Dunbar2010-04-221-2/+3
| | | | | | failure on bootstrap. llvm-svn: 102043
* Unify two diagnostics into one.Anders Carlsson2010-04-221-3/+2
| | | | llvm-svn: 102040
* Remove an unused parameter from isImplicitlyDefined.Anders Carlsson2010-04-201-2/+1
| | | | llvm-svn: 101962
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-191-36/+79
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Only suppress the "extern variable has an initializer" warning when the ↵Douglas Gregor2010-04-191-1/+1
| | | | | | extern entity being initialized is const. llvm-svn: 101821
OpenPOWER on IntegriCloud