Browse Source

Parsed friendly non-type declarations.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/398/head
Dimitar Dobrev 11 years ago
parent
commit
b6e5fe3c0e
  1. 10
      src/CppParser/Parser.cpp
  2. 15
      tests/Basic/Basic.cpp
  3. 10
      tests/Basic/Basic.h

10
src/CppParser/Parser.cpp

@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
#include <clang/Config/config.h>
#include <clang/AST/ASTContext.h>
#include <clang/AST/Comment.h>
#include <clang/AST/DeclFriend.h>
#include <clang/AST/DeclTemplate.h>
#include <clang/AST/ExprCXX.h>
#include <clang/Lex/DirectoryLookup.h>
@ -2902,6 +2903,14 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D, @@ -2902,6 +2903,14 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D,
Decl->_Namespace = NS;
break;
}
case Decl::Friend:
{
auto FD = cast<FriendDecl>(D);
if (auto Friend = FD->getFriendDecl())
return WalkDeclaration(Friend, IgnoreSystemDecls, CanBeDefinition);
break;
}
// Ignore these declarations since they must have been declared in
// a class already.
case Decl::CXXDestructor:
@ -2910,7 +2919,6 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D, @@ -2910,7 +2919,6 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D,
break;
case Decl::Empty:
case Decl::AccessSpec:
case Decl::Friend:
case Decl::Using:
case Decl::UsingDirective:
case Decl::UsingShadow:

15
tests/Basic/Basic.cpp

@ -342,3 +342,18 @@ InternalCtorAmbiguity* InvokesInternalCtorAmbiguity::InvokeInternalCtor() @@ -342,3 +342,18 @@ InternalCtorAmbiguity* InvokesInternalCtorAmbiguity::InvokeInternalCtor()
{
return ptr;
}
HasFriend::HasFriend(int m)
{
this->m = m;
}
int HasFriend::getM()
{
return m;
}
DLL_API inline const HasFriend operator+(const HasFriend& f1, const HasFriend& f2)
{
return HasFriend(f1.m + f2.m);
}

10
tests/Basic/Basic.h

@ -661,3 +661,13 @@ public: @@ -661,3 +661,13 @@ public:
private:
InternalCtorAmbiguity* ptr;
};
class DLL_API HasFriend
{
public:
HasFriend(int m);
DLL_API friend inline const HasFriend operator+(const HasFriend& f1, const HasFriend& f2);
int getM();
private:
int m;
};

Loading…
Cancel
Save