summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/class.access
Commit message (Collapse)AuthorAgeFilesLines
...
* Return a declaration to the parser when creating a field in C++ so thatJohn McCall2011-02-151-0/+14
| | | | | | | | | the parser will complete the declarator with a valid decl and thus trigger delayed diagnostics for it. It certainly looks like we were intentionally returning null here, but I couldn't find any good reason for it, and there wasn't a comment, so farewell to all that. llvm-svn: 125556
* Don't crash on hierarchy static_casts which appear in variable initializers.John McCall2011-02-141-0/+15
| | | | | | PR9221. llvm-svn: 125532
* Change the context correctly when instantiating a static data member definition.John McCall2011-02-141-0/+10
| | | | llvm-svn: 125517
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-0/+21
| | | | | | | | | | | | | | | | | | | | | | 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
* When building a user-defined conversion sequence, keep track of theDouglas Gregor2011-01-201-0/+10
| | | | | | | declaration that name lookup actually found, so that we can use it for access checking later on. Fixes <rdar://problem/8876150>. llvm-svn: 123867
* Access control polish: drop the note on the original declaration andJohn McCall2010-10-202-4/+33
| | | | | | say 'implicitly' when it was implicit. Resolves PR 7930 and my peace of mind. llvm-svn: 116916
* Support friend function declarations in local classes correctly.John McCall2010-10-131-0/+19
| | | | | | | | Fixes a crash and diagnoses the error condition of an unqualified friend which doesn't resolve to something. I'm still not certain how this is useful. llvm-svn: 116393
* PR8325: don't do destructor checking when a pointer is thrown.Eli Friedman2010-10-121-0/+8
| | | | llvm-svn: 116336
* Add a quick-and-dirty hack to give a better diagnostic for [class.protected]John McCall2010-09-032-8/+8
| | | | | | | | | | 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-0/+28
| | | | llvm-svn: 112360
* When checking access control for an instance member access onJohn McCall2010-08-281-6/+23
| | | | | | | | | 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
* Work around a crash when checking access to injected class namesJohn McCall2010-08-131-0/+14
| | | | | | | | | | qua templates. The current fix suppresses the access check entirely in this case; to do better, we'd need to be able to say that a particular lookup result came from a particular injected class name, which is not easy to do with the current representation of LookupResult. This is on my known-problems list. llvm-svn: 111009
* Perform access control when template lookup finds a class template.John McCall2010-08-131-0/+9
| | | | | | This is *really* hacky. llvm-svn: 110997
* Treat template parameters as part of the declaration-specifiers for theJohn McCall2010-07-161-0/+20
| | | | | | | | purpose of access control. Fixes PR7644. I can't actually find anything directly justifying this, but it seems obvious. llvm-svn: 108521
* Reinstate the fix for PR7556. A silly use of isTrivial() wasDouglas Gregor2010-07-081-2/+3
| | | | | | suppressing copies of objects with trivial copy constructors. llvm-svn: 107857
* Revert r107828 and r107827, the fix for PR7556, which seems to beDouglas Gregor2010-07-071-3/+2
| | | | | | breaking bootstrap on Linux. llvm-svn: 107837
* Do not use CXXZeroValueInitExpr for class types. Instead, useDouglas Gregor2010-07-071-2/+3
| | | | | | | | | CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as appropriate. Fixes PR7556, and provides a slide codegen improvement when copy-initializing a POD class type from a value-initialized temporary. Previously, we weren't eliding the copy. llvm-svn: 107827
* A bug I've introduced in STDIN handling surfaced a few broken tests, fix them.Benjamin Kramer2010-06-251-1/+1
| | | | | | Lexer/hexfloat.cpp is now XFAIL'd, I'd appreciate if someone could look into it. llvm-svn: 106840
* Make sure to check the accessibility of and mark the destructor for theEli Friedman2010-06-031-0/+6
| | | | | | operand of a throw expression. Fixes PR7281. llvm-svn: 105408
* When we complain about a member being inaccessible due to a constraintDouglas Gregor2010-05-285-21/+28
| | | | | | | along an access path, add another note pointing at the member we actually found. llvm-svn: 104937
* When filtering out previous declarations of friend functions, consider theJohn McCall2010-05-281-3/+22
| | | | | | lookup context, not the direct semantic context. Fixes PR7230. llvm-svn: 104917
* I hate this commit.Douglas Gregor2010-05-181-2/+2
| | | | | | | | | | | | | | | | | | | | | Revert much of the implementation of C++98/03 [temp.friend]p5 in r103943 and its follow-ons r103948 and r103952. While our implementation was technically correct, other compilers don't seem to implement this paragraph (which forces the instantiation of friend functions defined in a class template when a class template specialization is instantiated), and doing so broke a bunch of Boost libraries. Since this behavior has changed in C++0x (which instantiates the friend function definitions when they are used), we're going to skip the nowhere-implemented C++98/03 semantics and go straight to the C++0x semantics. This commit is a band-aid to get Boost up and running again. It doesn't really fix PR6952 (which this commit un-fixes), but it does deal with the way Boost.Units abuses this particular paragraph. llvm-svn: 104014
* C++98/03 [temp.friend]p4 requires that inline function definitionsDouglas Gregor2010-05-171-2/+2
| | | | | | | | within class templates be instantiated along with each class template specialization, even if the functions are not used. Do so, as a baby step toward PR6952. llvm-svn: 103943
* When we emit an error during the implicit definition of a specialDouglas Gregor2010-05-121-9/+11
| | | | | | | | member function (default constructor, copy constructor, copy assignment operator, destructor), emit a note showing where that implicit definition was required. llvm-svn: 103619
* Speculatively revert r103497, "Do not mark the virtual members of anDaniel Dunbar2010-05-111-11/+9
| | | | | | implicitly-instantiated class as ...", which seems to have broken bootstrap. llvm-svn: 103515
* Do not mark the virtual members of an implicitly-instantiated class asDouglas Gregor2010-05-111-9/+11
| | | | | | | | referenced unless we see one of them defined (or the key function defined, if it as one) or if we need the vtable for something. Fixes PR7114. llvm-svn: 103497
* An access is permitted if the current template instantiates to the appropriateJohn McCall2010-05-041-0/+55
| | | | | | class. Add some conservative support for the idea. Fixes PR 7024. llvm-svn: 102999
* Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor2010-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assignment operators. Previously, Sema provided type-checking and template instantiation for copy assignment operators, then CodeGen would synthesize the actual body of the copy constructor. Unfortunately, the two were not in sync, and CodeGen might pick a copy-assignment operator that is different from what Sema chose, leading to strange failures, e.g., link-time failures when CodeGen called a copy-assignment operator that was not instantiation, run-time failures when copy-assignment operators were overloaded for const/non-const references and the wrong one was picked, and run-time failures when by-value copy-assignment operators did not have their arguments properly copy-initialized. This implementation synthesizes the implicitly-defined copy assignment operator bodies in Sema, so that the resulting ASTs encode exactly what CodeGen needs to do; there is no longer any special code in CodeGen to synthesize copy-assignment operators. The synthesis of the body is relatively simple, and we generate one of three different kinds of copy statements for each base or member: - For a class subobject, call the appropriate copy-assignment operator, after overload resolution has determined what that is. - For an array of scalar types or an array of class types that have trivial copy assignment operators, construct a call to __builtin_memcpy. - For an array of class types with non-trivial copy assignment operators, synthesize a (possibly nested!) for loop whose inner statement calls the copy constructor. - For a scalar type, use built-in assignment. This patch fixes at least a few tests cases in Boost.Spirit that were failing because CodeGen picked the wrong copy-assignment operator (leading to link-time failures), and I suspect a number of undiagnosed problems will also go away with this change. Some of the diagnostics we had previously have gotten worse with this change, since we're going through generic code for our type-checking. I will improve this in a subsequent patch. llvm-svn: 102853
* Test case for r102578.John McCall2010-04-291-0/+14
| | | | llvm-svn: 102580
* Properly switch into the declaring scope of a template when performingJohn McCall2010-04-291-0/+53
| | | | | | | | | | template argument deduction or (more importantly) the final substitution required by such deduction. Makes access control magically work in these cases. Fixes PR6967. llvm-svn: 102572
* When we create a temporary of class type that we don't immediatelyDouglas Gregor2010-04-241-0/+13
| | | | | | | bind, check accessibility of the destructor and mark the declaration as referenced. Fixes a bunch of Boost.Regex failures. llvm-svn: 102287
* Recommit my change to how C++ does elaborated type lookups, now withJohn McCall2010-04-231-0/+7
| | | | | | 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-7/+0
| | | | | | 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-0/+7
| | | | | | | | | | | | | 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
* Keep tack of whether a base in an InitializedEntity is an inherited virtual ↵Anders Carlsson2010-04-211-3/+2
| | | | | | base or not. Use this in CheckConstructorAccess. llvm-svn: 102020
* Pass the InitializedEntity to Sema::CheckConstructorAccess and use it to ↵Anders Carlsson2010-04-211-1/+13
| | | | | | 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-0/+24
| | | | | | | return types, and default arguments. This fixes PR6855 along with several similar cases where we rejected valid code. llvm-svn: 101706
* Support befriending members of class template specializations.John McCall2010-04-131-0/+34
| | | | llvm-svn: 101173
* Allow classes to befriend implicitly-declared members. Fixes PR6207 forJohn McCall2010-04-131-0/+11
| | | | | | members of non-templated classes. llvm-svn: 101122
* Don't try to find a scope corresponding to the search DC for an unfoundJohn McCall2010-04-131-0/+19
| | | | | | | friend declaration; this used to be important but is now just a waste of time plus an unreasonable assertion. Fixes PR6174. llvm-svn: 101112
* Turn access control on by default in -cc1.John McCall2010-04-097-7/+7
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* Improve handling of friend types in several ways:Douglas Gregor2010-04-072-0/+42
| | | | | | | | | | | - When instantiating a friend type template, perform semantic analysis on the resulting type. - Downgrade the errors concerning friend type declarations that do not refer to classes to ExtWarns in C++98/03. C++0x allows practically any type to be befriended, and ignores the friend declaration if the type is not a class. llvm-svn: 100635
* Check access for the implicit calls to destructors that occur when weJohn McCall2010-04-071-0/+12
| | | | | | | | 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-0/+387
| | | | | | | | 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
* Check in a motivating test for the revised access semantics.John McCall2010-04-021-0/+16
| | | | llvm-svn: 100159
* Correct the calculation of access to more closely model the wording inJohn McCall2010-04-021-0/+59
| | | | | | the standard. llvm-svn: 100155
* Propagate the "found declaration" (i.e. the using declaration instead ofJohn McCall2010-03-301-0/+18
| | | | | | | | | | | | | 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
* Accumulate all functions and classes that the effective context isJohn McCall2010-03-271-0/+14
| | | | | | | | 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
* add a slight variation of test3, whereGabor Greif2010-03-261-0/+12
| | | | | | | argument list seems to be different, but in fact is semantically equivalent; check that we do not error here llvm-svn: 99617
* Do not mark the destructor of a function parameter's type. Fixes PR6709.Douglas Gregor2010-03-261-2/+2
| | | | llvm-svn: 99615
OpenPOWER on IntegriCloud