Browse Source

Changed parser to when processing macro expansions of a translation unit declaration to add the macro expansion to header it is on instead of the translation unit top header.

pull/220/merge
marcos henrich 11 years ago committed by triton
parent
commit
a27fbd4286
  1. 12
      src/Parser/Parser.cpp

12
src/Parser/Parser.cpp

@ -2114,7 +2114,6 @@ CppSharp::AST::PreprocessedEntity^ Parser::WalkPreprocessedEntity( @@ -2114,7 +2114,6 @@ CppSharp::AST::PreprocessedEntity^ Parser::WalkPreprocessedEntity(
auto Definition = gcnew CppSharp::AST::MacroDefinition();
Entity = Definition;
Definition->Namespace = GetTranslationUnit(MD->getLocation(), NULL);
Definition->Name = clix::marshalString<clix::E_UTF8>(II->getName())->Trim();
Definition->Expression = clix::marshalString<clix::E_UTF8>(Expression)->Trim();
}
@ -2124,7 +2123,16 @@ CppSharp::AST::PreprocessedEntity^ Parser::WalkPreprocessedEntity( @@ -2124,7 +2123,16 @@ CppSharp::AST::PreprocessedEntity^ Parser::WalkPreprocessedEntity(
return nullptr;
Entity->OriginalPtr = System::IntPtr(PPEntity);
Decl->PreprocessedEntities->Add(Entity);
Entity->Namespace = GetTranslationUnit(PPEntity->getSourceRange().getBegin(), NULL);
if (Decl->GetType() == CppSharp::AST::TranslationUnit::typeid)
{
Entity->Namespace->PreprocessedEntities->Add(Entity);
}
else
{
Decl->PreprocessedEntities->Add(Entity);
}
return Entity;
}

Loading…
Cancel
Save