llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.26k stars 12.08k forks source link

LLVM buildASTFromCodeWithArgs -std=c++17 argument/flag exception #53333

Open tisseq opened 2 years ago

tisseq commented 2 years ago

Hello, Im using LLVM lib release 13.0.0 and im parsing c++ files using buildASTfromCodeWithArgsmethod. When im trying to parse one certain file with passed argument -std=c++17 it throws stack overflow exception image

When im using argument -std=c++14 or -std=c++11 the problem goes away and it works fine. Also when I dont use this argument problem does not exist too.

The file im trying to parse contains only include to another file and some defines.

Thats code for executing buildASTFromCodeWithArgs method:

std::unique_ptr<clang::ASTUnit> ast{
         clang::tooling::buildASTFromCodeWithArgs(fileContent, args, file, "clang++",
                                                  std::make_shared<PCHContainerOperations>(),
                                                  tooling::getClangStripDependencyFileAdjuster(),
                                                  tooling::FileContentMappings(),
                                                  diagnosticConsumer)
      };

where fileContent is files text, args is as I said "-std=c++17", file is path to file.

llvmbot commented 2 years ago

@llvm/issue-subscribers-clang-frontend