Concept kulkarni via llvm-dev
2021-Jun-04 06:39 UTC
[llvm-dev] Clang not able to parse large file
Hi Team, We are using clang libtooling infrastructure for performing static code analysis on some internal projects. However we have one .c file for which we are not able to perform static code analysis. We are getting the below error "Fatal Error: sorry,this include generates a translation unit too large for clang to process #include Dem_Deh.h". Actually that is true the header file is included more than 21,000 times in that c file and also the c file contains more than 500,000 lines of code. This c file is a generated file, not a hand written one. I also tried to preprocess the c file using clang -E command and I saw that the c file was pre-processesed only partly. LLVM/Clang version used :11.0.0 Operating systems: Windows 10 I am using visual studio 2019 to build llvm/clang sources. However these internal projects are built separately using a hightech compiler(tricore-gcc.exe) and with the hightech compiler the compilation of this c file (which has lot of includes )goes through and binaries are built. So I would like to know if I need to pass some special flag to parse large files or is there any limit to the file size that clang can parse. Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210604/75401e22/attachment.html>
Tim Northover via llvm-dev
2021-Jun-04 11:56 UTC
[llvm-dev] Clang not able to parse large file
Hi, On Fri, 4 Jun 2021 at 07:34, Concept kulkarni via llvm-dev <llvm-dev at lists.llvm.org> wrote:> So I would like to know if I need to pass some special flag to parse large files or is there any limit to the file size that clang can parse.I'm afraid not. It looks like the error is there because the buffer overflows `unsigned` (i.e. 4GB) and Clang isn't 64-bit safe in all of its processing (it even has a comment on the topic: https://github.com/llvm/llvm-project/blob/fd3f2518a4fe3f9ee52d03eb519bd654c3ce4055/clang/lib/Basic/SourceManager.cpp#L140). Tim.