From 82d6d609b404ef17bb8dc47958f9f11cfd1fdc7b Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 18 Feb 2014 14:03:20 +0000 Subject: [PATCH] Fixed parsing of preprocessed entities for parameter declarations. Clang reports a wrong source range for function parameters and since we already process them specially we should not process them in HandleDeclaration too, else we get duplicated entities. --- src/CppParser/Parser.cpp | 4 ++++ src/Parser/Parser.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index f654b6c0..94fa22c6 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -2133,6 +2133,10 @@ void Parser::HandleDeclaration(clang::Decl* D, Declaration* Decl) { HandlePreprocessedEntities(Decl); } + else if (clang::dyn_cast(D)) + { + // Ignore function parameters as we already walk their preprocessed entities. + } else { auto startLoc = GetDeclStartLocation(C.get(), D); diff --git a/src/Parser/Parser.cpp b/src/Parser/Parser.cpp index 9d180c3f..c7d97558 100644 --- a/src/Parser/Parser.cpp +++ b/src/Parser/Parser.cpp @@ -2157,6 +2157,10 @@ void Parser::HandleDeclaration(clang::Decl* D, CppSharp::AST::Declaration^ Decl) { HandlePreprocessedEntities(Decl); } + else if (clang::dyn_cast(D)) + { + // Ignore function parameters as we already walk their preprocessed entities. + } else { auto startLoc = GetDeclStartLocation(C.get(), D);