GrammaTech / clang-mutate

Manipulate C-family ASTs with Clang
Other
64 stars 6 forks source link

Assertion failed in any test cases if clang/llvm are compiled from source as a debug build #2

Closed lioujheyu closed 6 years ago

lioujheyu commented 6 years ago

Error message

clang-mutate: /home/jliou4/llvm-4/tools/clang/lib/Basic/SourceManager.cpp:975: Assertion Loc.isMacroID() && "Not a macro expansion loc!" failed.

Call stack

Only a few of them on the top are listed

libc.so.6!__GI___assert_fail(const char * assertion, const char * file, unsigned int line, const char * function) (/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:101)
clang::SourceManager::getImmediateExpansionRange(const clang::SourceManager * const this, clang::SourceLocation Loc) (/share/home/jliou4/llvm-4/tools/clang/lib/Basic/SourceManager.cpp:975)
Utils::contains_macro<clang::Stmt>(clang::Stmt * clang_obj, clang::SourceManager & sm) (/share/home/jliou4/genetic-programming/clang-mutate/Utils.h:129)
clang_mutate::Requirements::gatherMacro(clang_mutate::Requirements * this, clang::Stmt * stmt) 

Steps of reproduce

Environment

jaruchti commented 6 years ago

@lioujheyu Thanks for the report. Unfortunately, we do not currently support non-release builds of clang; however, if you can suggest a patch to remedy this issue we would be happy to apply it. Regrettably, this may be tedious and difficult; much of the code related to macro handling depends on the release behavior of getImmediateExpansionRange and associated macro-related routines. I suspect much of this code would need to be wrapped in isMacroID() checks to avoid triggering this assertion.