1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

Revert "Bug 419301 - Operator overloading confuses CDT (with boost)"

This reverts commit ebc858ec44.
This commit is contained in:
Sergey Prigogin 2013-12-16 16:23:51 -08:00
parent e72c037dbd
commit e622794f73
3 changed files with 11 additions and 69 deletions

View file

@ -2403,55 +2403,4 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
IType T = getBindingFromASTName("T", 1); IType T = getBindingFromASTName("T", 1);
assertEquals("int", ASTTypeUtil.getType(T)); assertEquals("int", ASTTypeUtil.getType(T));
} }
// template <class T, class U>
// struct multipliable2
// {
// friend T operator *(const U& lhs, const T& rhs);
// };
//
// template <class T>
// struct multipliable1
// {
// friend T operator *(const T& lhs, const T& rhs);
// };
// #include "header.h"
// struct overloaded : multipliable1<overloaded> {};
//
// int foo(overloaded);
//
// int main()
// {
// overloaded c, d;
// foo(c * d);
// }
public void testFriendFunctionOfClassSpecialization_419301a() throws Exception {
checkBindings();
}
// template <class T, class U>
// struct multipliable2
// {
// friend T operator *(const U& lhs, const T& rhs);
// };
//
// template <class T>
// struct multipliable1
// {
// friend T operator *(const T& lhs, const T& rhs) {}
// };
// #include "header.h"
// struct overloaded : multipliable1 <overloaded> {};
//
// int foo(overloaded);
//
// int main() {
// overloaded c, d;
// foo(c * d);
// }
public void testFriendFunctionOfClassSpecialization_419301b() throws Exception {
checkBindings();
}
} }

View file

@ -367,9 +367,7 @@ class PDOMCPPClassSpecialization extends PDOMCPPSpecialization implements
@Override @Override
public IBinding[] getFriends(IASTNode point) { public IBinding[] getFriends(IASTNode point) {
ICPPClassScope scope= getCompositeScope(); // Not yet supported.
if (scope instanceof ICPPClassSpecializationScope)
return ((ICPPClassSpecializationScope) scope).getFriends(point);
return IBinding.EMPTY_BINDING_ARRAY; return IBinding.EMPTY_BINDING_ARRAY;
} }

View file

@ -21,8 +21,6 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
@ -1043,20 +1041,17 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
} }
} }
} else if (parentNode instanceof ICPPASTFunctionDeclarator) { } else if (parentNode instanceof ICPPASTFunctionDeclarator) {
IASTDeclSpecifier declSpec = null;
if (parentNode.getParent() instanceof IASTSimpleDeclaration) { if (parentNode.getParent() instanceof IASTSimpleDeclaration) {
declSpec = ((IASTSimpleDeclaration) parentNode.getParent()).getDeclSpecifier(); IASTSimpleDeclaration grandparentNode = (IASTSimpleDeclaration) parentNode.getParent();
} else if (parentNode.getParent() instanceof IASTFunctionDefinition) { if (grandparentNode.getDeclSpecifier() instanceof ICPPASTDeclSpecifier) {
declSpec = ((IASTFunctionDefinition) parentNode.getParent()).getDeclSpecifier(); if (((ICPPASTDeclSpecifier) grandparentNode.getDeclSpecifier()).isFriend()) {
} pdomName.setIsFriendSpecifier();
if (declSpec instanceof ICPPASTDeclSpecifier) { PDOMName enclClassName = (PDOMName) pdomName.getEnclosingDefinition();
if (((ICPPASTDeclSpecifier) declSpec).isFriend()) { if (enclClassName != null) {
pdomName.setIsFriendSpecifier(); PDOMBinding enclClassBinding = enclClassName.getBinding();
PDOMName enclClassName = (PDOMName) pdomName.getEnclosingDefinition(); if (enclClassBinding instanceof PDOMCPPClassType) {
if (enclClassName != null) { ((PDOMCPPClassType) enclClassBinding).addFriend(new PDOMCPPFriend(this, pdomName));
PDOMBinding enclClassBinding = enclClassName.getBinding(); }
if (enclClassBinding instanceof PDOMCPPClassType) {
((PDOMCPPClassType) enclClassBinding).addFriend(new PDOMCPPFriend(this, pdomName));
} }
} }
} }