Browse Source

Fixed parsing of function signatures with const-qualified return types.

pull/441/head
triton 10 years ago
parent
commit
7d5e53e1df
  1. 2
      src/CppParser/Parser.cpp
  2. 1
      src/Generator.Tests/AST/TestAST.cs
  3. 1
      tests/Native/AST.h

2
src/CppParser/Parser.cpp

@ -2219,8 +2219,6 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Function* F, @@ -2219,8 +2219,6 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Function* F,
}
clang::SourceLocation BeginLoc = FD->getLocStart();
if (ResultLoc.isValid())
BeginLoc = ResultLoc;
// For some weird reason 'kw_const' doesn't work; Clang considers the 'const' a 'raw_identifier'
clang::SourceLocation EndLoc = Lexer::findLocationAfterToken(

1
src/Generator.Tests/AST/TestAST.cs

@ -246,6 +246,7 @@ namespace CppSharp.Generator.Tests.AST @@ -246,6 +246,7 @@ namespace CppSharp.Generator.Tests.AST
Assert.AreEqual("void testSignature()", AstContext.FindFunction("testSignature").Single().Signature);
Assert.AreEqual("void testImpl()", AstContext.FindFunction("testImpl").Single().Signature);
Assert.AreEqual("void testConstSignature() const", AstContext.FindClass("HasConstFunction").Single().FindMethod("testConstSignature").Signature);
Assert.AreEqual("const int& testConstRefSignature()", AstContext.FindClass("HasConstFunction").Single().FindMethod("testConstRefSignature").Signature);
}
}
}

1
tests/Native/AST.h

@ -71,6 +71,7 @@ class HasConstFunction @@ -71,6 +71,7 @@ class HasConstFunction
{
public:
void testConstSignature() const;
const int& testConstRefSignature();
};
void testImpl()

Loading…
Cancel
Save