summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAccess.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-1/+1
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-8/+8
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Implement caching of default constructors on the resolution table. ThisAlexis Hunt2011-06-101-10/+28
| | | | | | | | isn't yet used for the less controlled environments of initialization. Also a few random text fixups. llvm-svn: 132833
* Update our diagnostics to properly account for move operations.Alexis Hunt2011-05-251-4/+2
| | | | llvm-svn: 132096
* Emulate a MSVC bug where if during an using declaration name lookup, the ↵Francois Pichet2011-05-231-4/+48
| | | | | | | | | | | | | | | declaration found is unaccessible (private) and that declaration was bring into scope via another using declaration whose target declaration is accessible (public) then no error is generated. Example: class A { public: int f(); }; class B : public A { private: using A::f; }; class C : public B { private: using B::f; }; Here, B::f is private so this should fail in Standard C++, but because B::f refers to A::f which is public MSVC accepts it. This fixes 1 error when parsing MFC code with clang. llvm-svn: 131896
* Undo enough of r131143 to make private copy ctor diags say "copy ↵Matt Beaumont-Gay2011-05-191-2/+6
| | | | | | constructor" again llvm-svn: 131706
* HrmAlexis Hunt2011-05-121-3/+5
| | | | llvm-svn: 131259
* Re-do R131114 without breaking code.Alexis Hunt2011-05-101-6/+4
| | | | | | | | | I've edited one diagnostic which would print "copy constructor" for copy constructors and "constructor" for any other constructor. If anyone is extremely enamored with this, it can be reinstated with a simple boolean flag rather than calling getSpecialMember, which is inappropriate. llvm-svn: 131143
* Implement support for C++0x alias templates.Richard Smith2011-05-051-2/+2
| | | | llvm-svn: 130953
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-8/+8
| | | | llvm-svn: 129567
* Handle delayed access in local declarations. PR9229.John McCall2011-02-151-10/+14
| | | | llvm-svn: 125609
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-7/+13
| | | | | | | | | | | | | | | | | | | | | | access-control diagnostics which arise from the portion of the declarator following the scope specifier, just in case access is granted by friending the individual method. This can also happen with in-line member function declarations of class templates due to templated-scope friend declarations. We were really playing fast-and-loose before with this sort of thing, and it turned out to work because *most* friend functions are in file scope. Making us delay regardless of context exposed several bugs with how we were manipulating delay. I ended up needing a concept of a context that's independent of the declarations in which it appears, and then I actually had to make some things save contexts correctly, but delay should be much cleaner now. I also encapsulated all the delayed-diagnostics machinery in a single subobject of Sema; this is a pattern we might want to consider rolling out to other components of Sema. llvm-svn: 125485
* Minor whitespace and comment fixes. No functionality change.Nico Weber2010-11-281-1/+1
| | | | llvm-svn: 120266
* Access control polish: drop the note on the original declaration andJohn McCall2010-10-201-1/+43
| | | | | | say 'implicitly' when it was implicit. Resolves PR 7930 and my peace of mind. llvm-svn: 116916
* White-listing templated-scope friend decls is a good idea, but doing itJohn McCall2010-10-161-2/+3
| | | | | | | | by marking the decl invalid isn't. Make some steps towards supporting these and then hastily shut them down at the last second by marking them as unsupported. llvm-svn: 116661
* Handle dependent friends more explicitly and deal with the possibilityJohn McCall2010-10-121-0/+4
| | | | | | | | of templated-scope friends by marking them invalid and white-listing all accesses until such time as we implement them. Fixes a crash, this time without a broken test case. llvm-svn: 116364
* Add a quick-and-dirty hack to give a better diagnostic for [class.protected]John McCall2010-09-031-0/+55
| | | | | | | | | | restrictions. The note's not really on the right place given its wording, but putting a second note on the call site (or muddying the wording) doesn't appeal. There are corner cases where this can be wrong, but I'm not concerned. llvm-svn: 112950
* That's not the right direction to compute notional accessibility in at all.John McCall2010-08-281-21/+28
| | | | llvm-svn: 112360
* Fix build. Bad me, adding last-minute assertions.John McCall2010-08-281-1/+1
| | | | llvm-svn: 112359
* When checking access control for an instance member access onJohn McCall2010-08-281-8/+130
| | | | | | | | | an object of type I, if the current access target is protected when named in a class N, consider the friends of the classes P where I <= P <= N and where a notional member of N would be non-forbidden in P. llvm-svn: 112358
* Propagate whether an id-expression is the immediate argument ofJohn McCall2010-08-271-1/+1
| | | | | | | | | | | | | | | | | | | an '&' expression from the second caller of ActOnIdExpression. Teach template argument deduction that an overloaded id-expression doesn't give a valid type for deduction purposes to a non-static member function unless the expression has the correct syntactic form. Teach ActOnIdExpression that it shouldn't try to create implicit member expressions for '&function', because this isn't a permitted form of use for member functions. Teach CheckAddressOfOperand to diagnose these more carefully. Some of these cases aren't reachable right now because earlier diagnostics interrupt them. llvm-svn: 112258
* Restore r112114 now that SmallVector<...,0> is safe.John McCall2010-08-261-4/+6
| | | | llvm-svn: 112148
* Revert r112114, "Pull DelayedDiagnostic and AccessedEntity out into their ownDaniel Dunbar2010-08-261-6/+4
| | | | | | header.", it is teh broken. llvm-svn: 112123
* Pull DelayedDiagnostic and AccessedEntity out into their own header.John McCall2010-08-251-4/+6
| | | | | | | | This works courtesy of the new SmallVector<..., 0> specialization that doesn't require a complete type. Note that you'll need to pull at least SmallVector.h from LLVM to compile successfully. llvm-svn: 112114
* Split out a header to hold APIs meant for the Sema implementation from Sema.h.John McCall2010-08-251-1/+1
| | | | | | | Clients of Sema don't need to know (for example) the list of diagnostics we support. llvm-svn: 112093
* Revert r111609, which is failing its new test.Douglas Gregor2010-08-201-3/+0
| | | | llvm-svn: 111611
* Detect efforts to declare a template member friend and explicitly ignore them.John McCall2010-08-201-0/+3
| | | | | | Avoids a crash. llvm-svn: 111609
* Move Sema's headers into include/clang/Sema, renaming a few along the way.Douglas Gregor2010-08-121-3/+3
| | | | llvm-svn: 110945
* Partial fix for PR7267 based on comments by John McCall on an earlier patch.Chandler Carruth2010-06-281-0/+15
| | | | | | | | | | | | | | | | | | This is more targeted, as it simply provides toggle actions for the parser to turn access checking on and off. We then use these to suppress access checking only while we parse the template-id (included scope specifier) of an explicit instantiation and explicit specialization of a class template. The specialization behavior is an extension, as it seems likely a defect that the standard did not exempt them as it does explicit instantiations. This allows the very common practice of specializing trait classes to work for private, internal types. This doesn't address instantiating or specializing function templates, although those apparently already partially work. The naming and style for the Action layer isn't my favorite, comments and suggestions would be appreciated there. llvm-svn: 106993
* PR7245: Make binding a reference to a temporary without a usable copyJeffrey Yasskin2010-06-071-4/+7
| | | | | | constructor into an extension warning into the error that C++98 requires. llvm-svn: 105529
* When we complain about a member being inaccessible due to a constraintDouglas Gregor2010-05-281-0/+4
| | | | | | | along an access path, add another note pointing at the member we actually found. llvm-svn: 104937
* An access is permitted if the current template instantiates to the appropriateJohn McCall2010-05-041-3/+29
| | | | | | class. Add some conservative support for the idea. Fixes PR 7024. llvm-svn: 102999
* Add another 'catch all' access diagnostic.Anders Carlsson2010-04-231-2/+3
| | | | llvm-svn: 102169
* Use the naming class from the overloaded lookup when access-checking anJohn McCall2010-04-221-9/+1
| | | | | | | | | | address of overloaded function, instead of assuming that a nested name specifier was used. A nested name specifier is not required for static functions. Fixes PR6886. llvm-svn: 102107
* Re-land the patch that merges two diagnostics into one now that it passes ↵Anders Carlsson2010-04-221-7/+6
| | | | | | self-host :) llvm-svn: 102050
* Revert "Unify two diagnostics into one.", it breaks with an assertion ↵Daniel Dunbar2010-04-221-6/+7
| | | | | | failure on bootstrap. llvm-svn: 102043
* Unify two diagnostics into one.Anders Carlsson2010-04-221-7/+6
| | | | llvm-svn: 102040
* Diagnose access to fields with private constructors.Anders Carlsson2010-04-211-0/+7
| | | | llvm-svn: 102025
* Keep tack of whether a base in an InitializedEntity is an inherited virtual ↵Anders Carlsson2010-04-211-2/+6
| | | | | | base or not. Use this in CheckConstructorAccess. llvm-svn: 102020
* Pass the InitializedEntity to Sema::CheckConstructorAccess and use it to ↵Anders Carlsson2010-04-211-5/+16
| | | | | | report different diagnostics depending on which entity is being initialized. llvm-svn: 102010
* Fix the access checking of function and function template argument types,Chandler Carruth2010-04-181-2/+9
| | | | | | | return types, and default arguments. This fixes PR6855 along with several similar cases where we rejected valid code. llvm-svn: 101706
* Check access for the implicit calls to destructors that occur when weJohn McCall2010-04-071-1/+1
| | | | | | | | have a temporary object in C++. Also fix a tag mismatch that Doug noticed. llvm-svn: 100593
* Implement the protected access restriction ([class.protected]), which requiresJohn McCall2010-04-061-210/+421
| | | | | | | | that protected members be used on objects of types which derive from the naming class of the lookup. My first N attempts at this were poorly-founded, largely because the standard is very badly worded here. llvm-svn: 100562
* Correct the calculation of access to more closely model the wording inJohn McCall2010-04-021-123/+206
| | | | | | the standard. llvm-svn: 100155
* Fix an oversight with access control for address-of-function.John McCall2010-03-301-0/+1
| | | | llvm-svn: 99942
* Propagate the "found declaration" (i.e. the using declaration instead ofJohn McCall2010-03-301-0/+25
| | | | | | | | | | | | | the underlying/instantiated decl) through a lot of API, including "intermediate" MemberExprs required for (e.g.) template instantiation. This is necessary because of the access semantics of member accesses to using declarations: only the base class *containing the using decl* need be accessible from the naming class. This allows us to complete an access-controlled selfhost, if there are no recent regressions. llvm-svn: 99936
* Optimize PartialDiagnostic's memory-allocation behavior by placing aDouglas Gregor2010-03-291-11/+16
| | | | | | | | | | | | | | cache of PartialDiagnostic::Storage objects into an allocator within the ASTContext. This eliminates a significant amount of malloc traffic, for a 10% performance improvement in -fsyntax-only wall-clock time with 403.gcc's combine.c. Also, eliminate the RequireNonAbstractType hack I put in earlier, which was but a symptom of this larger problem. Fixes <rdar://problem/7806091>. llvm-svn: 99849
* Accumulate all functions and classes that the effective context isJohn McCall2010-03-271-35/+51
| | | | | | | | nested within, and suddenly local classes start working. Wouldn't be necessary if I hadn't used local classes in Clang in the first place. Or, well, wouldn't be necessary yet. :) llvm-svn: 99709
* Reapply r99596 with a fix: link an instantiated friend function to itsJohn McCall2010-03-261-1/+1
| | | | | | pattern if it has a body. llvm-svn: 99610
* Apparently that didn't work. Reverting for now.John McCall2010-03-261-1/+1
| | | | llvm-svn: 99601
OpenPOWER on IntegriCloud