diff --git a/libcextract/Passes.cpp b/libcextract/Passes.cpp index 115cd93..d701af2 100644 --- a/libcextract/Passes.cpp +++ b/libcextract/Passes.cpp @@ -79,7 +79,7 @@ static bool Build_ASTUnit(PassManager::Context *ctx, IntrusiveRefCntPtr(); auto AU = ASTUnit::LoadFromCompilerInvocation( - CInvok, PCHContainerOps, Diags, FileMgr, false, CaptureDiagsKind::None, 1, + CInvok, PCHContainerOps, Diags, FileMgr, false, CaptureDiagsKind::None, 0, TU_Complete, false, false, false); if (AU == nullptr) { diff --git a/testsuite/includes/pch-1.c b/testsuite/includes/pch-1.c new file mode 100644 index 0000000..830ca79 --- /dev/null +++ b/testsuite/includes/pch-1.c @@ -0,0 +1,13 @@ +/* { dg-options "-DCE_EXTRACT_FUNCTIONS=main -DCE_NO_EXTERNALIZATION" }*/ + +#include "pch-1.h" + +DEFINE_FUNCTION; + +int main() +{ + function_0(); + return 0; +} + +/* { dg-final { scan-tree-dump "function_0" } } */ diff --git a/testsuite/includes/pch-1.h b/testsuite/includes/pch-1.h new file mode 100644 index 0000000..6654d1f --- /dev/null +++ b/testsuite/includes/pch-1.h @@ -0,0 +1,12 @@ +#define __DEFINE_FUNCTION(i) \ + int function_ ## i (void) { \ + return 0;\ + } + +#define _DEFINE_FUNCTION(i) \ + __DEFINE_FUNCTION(i) + +#define DEFINE_FUNCTION \ + _DEFINE_FUNCTION(__COUNTER__) + +DEFINE_FUNCTION;