summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* objc: allow typedef'ing an id to a pointer to a c-struct only.Fariborz Jahanian2012-05-141-6/+16
| | | | | | // rdar://11356439 llvm-svn: 156788
* Refactor all theRafael Espindola2012-05-131-23/+20
| | | | | | | | | if (Inherited) Attr->setInherited(true); To a central location. llvm-svn: 156728
* Produce a warning for mismatched section attributes. Completest pr9356.Rafael Espindola2012-05-131-0/+3
| | | | llvm-svn: 156727
* Fix a recent regression with the merging of format attributes.Rafael Espindola2012-05-111-0/+4
| | | | llvm-svn: 156597
* Fix an old (2009) FIXME:Rafael Espindola2012-05-101-13/+34
| | | | | | | | | | | | | | | | | | | | | // FIXME: This needs to happen before we merge declarations. Then, // let attribute merging cope with attribute conflicts. This was already being done for variables, but for functions we were merging then first and then applying the attributes. To avoid duplicating merging logic, some of the helpers in SemaDeclAttr.cpp become methods that can handle merging two attributes in one decl or inheriting attributes from one decl to another. With this change we are now able to produce errors for variables with incompatible visibility attributes or warn about unused dllimports in variables. This changes the attribute list iteration back to being in reverse source code order, as that matches what decl merging does and avoids differentiating the two cases is the merge*Attr methods. llvm-svn: 156531
* objective-c. Fixes a 'fixit' where location ofFariborz Jahanian2012-05-091-1/+2
| | | | | | | '*' on objective-c class name was misplaced. // rdar://11311333 llvm-svn: 156517
* Update the SelfReferenceChecker. Refactored some of the visitor methods.Richard Trieu2012-05-091-31/+49
| | | | | | | Added support for conditional operators and tightened the exclusion of the unary operator from all operators to only the address of operator. llvm-svn: 156450
* Split mergeAvailabilityAttr out of handleAvailabilityAttr. This is importantRafael Espindola2012-05-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | for having a uniform logic for adding attributes to a decl. This in turn is needed to fix the FIXME: // FIXME: This needs to happen before we merge declarations. Then, // let attribute merging cope with attribute conflicts. ProcessDeclAttributes(S, NewFD, D, /*NonInheritable=*/false, /*Inheritable=*/true); The idea is that mergeAvailabilityAttr will become a method. Once attributes are processed before merging, it will be called from handleAvailabilityAttr to handle multiple attributes in one decl: void f(int) __attribute__((availability(ios,deprecated=3.0), availability(ios,introduced=2.0))); and from SemaDecl.cpp to handle multiple decls: void f(int) __attribute__((availability(ios,deprecated=3.0))); void f(int) __attribute__((availability(ios,introduced=2.0))); As a bonus, use the new structure to diagnose incompatible availability attributes added to different decls (see included testcases). llvm-svn: 156269
* Switch RequireLiteralType() off of PartialDiagnostic.Douglas Gregor2012-05-041-1/+1
| | | | llvm-svn: 156178
* Revert most of r154844, which was disabled in r155975. Keep around theRichard Smith2012-05-021-1/+1
| | | | | | | refactorings in that revision, and some of the subsequent bugfixes, which seem to be relevant even without delayed exception specification parsing. llvm-svn: 156031
* Try harder to recognize hidden tag type names in potential declarations insteadKaelyn Uhrain2012-05-021-44/+70
| | | | | | of giving unhelpful errors about undeclared identifers and missing semicolons. llvm-svn: 155965
* Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.David Blaikie2012-04-301-6/+8
| | | | | | Reviewed by Doug Gregor. llvm-svn: 155839
* HandleDeclarator() returns NULL for semantic disasters. Deal with itDouglas Gregor2012-04-301-1/+1
| | | | | | | when we're in an Objective-C container context. Fixes <rdar://problem/11286701>. llvm-svn: 155836
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-5/+5
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Imrpove the note text for when a non-type decl hides a tag typeKaelyn Uhrain2012-04-271-1/+1
| | | | llvm-svn: 155723
* Add note to help explain why a tag such as 'struct' is needed to referKaelyn Uhrain2012-04-261-0/+8
| | | | | | | to a given type, when the reason is that there is a non-type decl with the same name. llvm-svn: 155677
* Fix regression in r154844. If necessary, defer computing adjusted destructorRichard Smith2012-04-211-15/+0
| | | | | | | exception specifications in C++11 until after we've parsed the exception specifications for nested classes. llvm-svn: 155293
* PR12569: Instantiate exception specifications of explicit instantiationsRichard Smith2012-04-171-2/+5
| | | | | | and explicit specializations of function templates appropriately. llvm-svn: 154956
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-2/+8
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-1/+8
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* PR12500: Improve the wording of the diagnostic for a redefinition of a nameRichard Smith2012-04-131-1/+1
| | | | | | in the wrong namespace scope. Patch by Jonathan Sauer! llvm-svn: 154656
* Fixed scoping error for late parsed attributes in nested classes.DeLesley Hutchins2012-04-061-1/+16
| | | | llvm-svn: 154173
* Replace the workaround from r153445 with a proper fix.Kaelyn Uhrain2012-04-031-14/+6
| | | | | | | | | | | | | Infinite recursion was happening when DiagnoseInvalidRedeclaration called ActOnFunctionDeclarator to check if a typo correction works when the correction was just to the nested-name-specifier because the wrong DeclContext was being passed in. Unlike a number of functions surrounding typo correction, the DeclContext passed in for a function is the context of the function name after applying any nested name specifiers, not the lexical DeclContext where the function+nested-name-specifier appears. llvm-svn: 153962
* Implement DR1402: if a field or base class is not movable, the derived class'sRichard Smith2012-04-021-2/+3
| | | | | | | | | | | move constructor/move assignment operator are not declared, rather than being defined as deleted, so move operations on the derived class fall back to copying rather than moving. If a move operation on the derived class is explicitly defaulted, the unmovable subobject will be copied instead of being moved. llvm-svn: 153883
* Basic semantic analysis support for inheriting constructor declarations inRichard Smith2012-04-021-1/+1
| | | | | | dependent contexts. llvm-svn: 153858
* Unify and fix our checking of C++ [dcl.meaning]p1's requirementsDouglas Gregor2012-03-281-85/+115
| | | | | | | | | concerning qualified declarator-ids. We now diagnose extraneous qualification at namespace scope (which we had previously missed) and diagnose these qualification errors for all kinds of declarations; it was rather uneven before. Fixes <rdar://problem/11135644>. llvm-svn: 153577
* When diagnosing an invalid out-of-line redeclaration, don't permitDouglas Gregor2012-03-261-1/+8
| | | | | | | typo correction to introduce a nested-name-specifier; we aren't prepared to handle it here. Fixes PR12297 / <rdar://problem/11075219>. llvm-svn: 153445
* Delay checking of dependent underlying types for redeclarations of memberRichard Smith2012-03-261-1/+3
| | | | | | enumerations in templates until the template is instantiated. llvm-svn: 153426
* When defining a forward-declared enum, don't try to attach the definition toRichard Smith2012-03-231-2/+3
| | | | | | | a previous declaration if the redeclaration is invalid. That way lies madness. Fixes a crash-on-invalid reported by Abramo. llvm-svn: 153349
* Support for definitions of member enumerations of class templates outside theRichard Smith2012-03-231-4/+13
| | | | | | | class template's definition, and for explicit specializations of such enum members. llvm-svn: 153304
* Diagnose tag and class template declarations with qualifiedDouglas Gregor2012-03-171-25/+43
| | | | | | declarator-ids that occur at class scope. Fixes PR8019. llvm-svn: 153002
* Warn on flexible array members when in C89 mode, with -pedantic.David Chisnall2012-03-161-0/+7
| | | | | | | | This fixes PR 4307. Patch by Eitan Adler! llvm-svn: 152918
* Remove a variable rendered unused by r152750.Richard Smith2012-03-151-1/+1
| | | | llvm-svn: 152758
* Instantiating a class template should not instantiate the definition of anyRichard Smith2012-03-141-35/+54
| | | | | | | | scoped enumeration members. Later uses of an enumeration temploid as a nested name specifier should cause its instantiation. Plus some groundwork for explicit specialization of member enumerations of class templates. llvm-svn: 152750
* Ensure that default arguments are handled correctly in sub scopes. For example:James Molloy2012-03-131-7/+8
| | | | | | | | | | | | | void f () { int g (int a, int b=4); { int g(int a, int b=5); } } should compile. llvm-svn: 152621
* PR11925: A function can't have a variably-modified return type. Not even in C++.Richard Smith2012-03-131-11/+12
| | | | llvm-svn: 152615
* Fix PR10447: lazily building name lookup tables for DeclContexts was broken.Richard Smith2012-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The deferred lookup table building step couldn't accurately tell which Decls should be included in the lookup table, and consequently built different tables in some cases. Fix this by removing lazy building of DeclContext name lookup tables. In practice, the laziness was frequently not worthwhile in C++, because we performed lookup into most DeclContexts. In C, it had a bit more value, since there is no qualified lookup. In the place of lazy lookup table building, we simply don't build lookup tables for function DeclContexts at all. Such name lookup tables are not useful, since they don't capture the scoping information required to correctly perform name lookup in a function scope. The resulting performance delta is within the noise on my testing, but appears to be a very slight win for C++ and a very slight loss for C. The C performance can probably be recovered (if it is a measurable problem) by avoiding building the lookup table for the translation unit. llvm-svn: 152608
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-140/+140
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-1/+1
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Slightly tweak this condition. "isTransparentContext()" was checking whether anNick Lewycky2012-03-101-2/+1
| | | | | | | | enum is scoped or not, which is not relevant here. Instead, phrase the loop in the same terms that the standard uses, instead of this awkward set of conditions that is *nearly* equal. llvm-svn: 152489
* Could not find this in C99. Perhaps this rule comes from a DR, but in any caseNick Lewycky2012-03-101-0/+1
| | | | | | | please annotate it with a note explaining why this wrong-seeming behaviour is correct. llvm-svn: 152488
* Improve our semantic error recovery.Argyrios Kyrtzidis2012-03-091-6/+30
| | | | | | | | | | | | | | | | | When an error made a record member invalid, the record would stay as "isBeingDefined" and not "completeDefinition". Even easily recoverable errors ended up propagating records in such "beingDefined" state, for example: struct A { ~A() const; // expected-error {{'const' qualifier is not allowed on a destructor}} }; struct B : A {}; // A & B would stay as "not complete definition" and "being defined". This weird state was impending lookups in the records and hitting assertion in the ASTWriter. Part of rdar://11007039 llvm-svn: 152432
* lldb support: under debugger support flag, when sending messageFariborz Jahanian2012-03-091-0/+12
| | | | | | | to forward class, and assigning to an 'id' type var, message sends default to 'id'. // rdar"//10988847 llvm-svn: 152420
* [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().Daniel Dunbar2012-03-091-30/+30
| | | | | | | | | - getSourceRange().getBegin() is about as awesome a pattern as .copy().size(). I already killed the hot paths so this doesn't seem to impact performance on my tests-of-the-day, but it is a much more sensible (and shorter) pattern. llvm-svn: 152419
* [AST] Reduce Decl::getASTContext() calls.Daniel Dunbar2012-03-091-1/+1
| | | | | | | - This function is not at all free; pass it around along some hot paths instead of recomputing it deep inside various VarDecl methods. llvm-svn: 152363
* Fix -Wuninitialized to catch the case of a class being initialized with a callRichard Trieu2012-03-081-1/+2
| | | | | | to its own member function. llvm-svn: 152276
* Reapply r151638 and r151641.James Molloy2012-02-291-1/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation. These are now fixed, with regression tests added to catch them both (not Darwin-specific). Original log: ==================== Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. ==================== llvm-svn: 151712
* Revert r151638 because it causes assertion hit on PCH creation for Cocoa.hArgyrios Kyrtzidis2012-02-281-70/+1
| | | | | | | | | | | | | | | | | | | | Original log: --------------------- Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. --------------------- I also reverted r151641 which was enhancement on top of r151638. llvm-svn: 151667
* Un-break clang based on r151638 - What was meant to be a trivial variable ↵James Molloy2012-02-281-1/+1
| | | | | | name change went horribly wrong and I forgot to retest afterwards. llvm-svn: 151641
* Correctly track tags and enum members defined in the prototype of a ↵James Molloy2012-02-281-1/+70
| | | | | | | | | | | | | | | function, and ensure they are properly scoped. This fixes code such as: enum e {x, y}; int f(enum {y, x} n) { return 0; } This finally fixes PR5464 and PR5477. llvm-svn: 151638
OpenPOWER on IntegriCloud