Commit Graph

14 Commits

Author SHA1 Message Date
Ben Langmuir 005c2e57a6 [vfs] Don't bail out after a missing -ivfsoverlay file
This make -ivfsoverlay behave more like other fatal errors (e.g. missing
-include file) by skipping the missing file instead of bailing out of
the whole compilation. This makes it possible for libclang to still
provide some functionallity as well as to correctly produce the fatal
error diagnostic (previously we lost the diagnostic in libclang since
there was no TU to tie it to).

rdar://33385423

llvm-svn: 328337
2018-03-23 17:37:27 +00:00
Ilya Biryukov 4a8f753306 [Frontend] Allow to use PrecompiledPreamble without calling CanReuse
Summary:
The new method 'OverridePreamble' allows to override the preamble of
any source file without checking if preamble bounds or dependencies
were changed.

This is used for completion in clangd.

Reviewers: bkramer, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D41990

llvm-svn: 322853
2018-01-18 15:16:53 +00:00
Ilya Biryukov 923e3388be Added helper to get size of PrecompiledPreamble
llvm-svn: 321266
2017-12-21 14:04:39 +00:00
Ilya Biryukov 1f8647d1c1 [clang] Add BeforeExecute method to PrecompiledPreamble
Summary: Adds BeforeExecute method to PrecompiledPreamble to be called
before Execute(). This method can be overriden.

Patch by William Enright.

Reviewers: malaperle, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: arphaman, cfe-commits, ilya-biryukov

Differential Revision: https://reviews.llvm.org/D41365

llvm-svn: 321189
2017-12-20 16:48:56 +00:00
Ilya Biryukov 41e90bcb77 [clang] Add PPCallbacks list to preprocessor when building a preacompiled preamble.
Summary:
Revision D38639 needs this commit in order to properly make open
definition calls on include statements work.

Patch by William Enright.

Reviewers: malaperle, krasimir, bkramer, ilya-biryukov

Reviewed By: malaperle, ilya-biryukov

Subscribers: cfe-commits, arphaman, ilya-biryukov

Differential Revision: https://reviews.llvm.org/D39375

llvm-svn: 320804
2017-12-15 11:27:51 +00:00
Ilya Biryukov 8318f61bb8 Avoid copying the data of in-memory preambles
Summary: Preambles are large and we should avoid copying them.

Reviewers: bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D40302

llvm-svn: 318945
2017-11-24 13:12:38 +00:00
Ilya Biryukov dd9ea751e1 Use llvm-config.h instead of config.h
To fix standalone builds broken by r318411 (config.h is private to llvm).

llvm-svn: 318514
2017-11-17 10:09:02 +00:00
Ilya Biryukov 417085ac37 Allow to store precompiled preambles in memory.
Summary:
These preambles are built by ASTUnit and clangd. Previously, preambles
were always stored on disk.

In-memory preambles are routed back to the compiler as virtual files in
a custom VFS.

Interface of ASTUnit does not allow to use in-memory preambles, as
ASTUnit::CodeComplete receives FileManager as a parameter, so we can't
change VFS used by the compiler inside the CodeComplete method.

A follow-up commit will update clangd in clang-tools-extra to use
in-memory preambles.

Reviewers: klimek, sammccall, bkramer

Reviewed By: klimek

Subscribers: ioeric, cfe-commits

Differential Revision: https://reviews.llvm.org/D39842

llvm-svn: 318411
2017-11-16 16:25:01 +00:00
Benjamin Kramer 24952ce5b9 Create fewer copies of StringMaps. No functionality change intended.
llvm-svn: 316301
2017-10-22 20:16:28 +00:00
Ilya Biryukov eb1ec876b3 Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.
Summary:
It was previsouly set only in ASTUnit, but it should be set for all client of
PrecompiledPreamble.

Reviewers: erikjv, bkramer, klimek

Reviewed By: bkramer

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D38617

llvm-svn: 315212
2017-10-09 16:52:12 +00:00
Cameron Desrochers 84fd064ef9 [PCH] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM presence)
This patch fixes broken preamble-skipping when the preamble region includes a byte order mark (BOM). Previously, parsing would fail if preamble PCH generation was enabled and a BOM was present.

This also fixes preamble invalidation when a BOM appears or disappears. This may seem to be an obscure edge case, but it happens regularly with IDEs that pass buffer overrides that never (or always) have a BOM, yet the underlying file from the initial parse that generated a PCH might (or might not) have a BOM.

I've included a test case for these scenarios.

Differential Revision: https://reviews.llvm.org/D37491

llvm-svn: 313796
2017-09-20 19:03:37 +00:00
Ilya Biryukov b88de41636 Fixed a race condition in PrecompiledPreamble.
Summary:
Two PrecompiledPreambles, used in parallel on separate threads,
could be writing preamble to the same temporary file.

Reviewers: bkramer, krasimir, klimek

Reviewed By: klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36529

llvm-svn: 310618
2017-08-10 16:10:40 +00:00
Haojian Wu 53dd644c5d Fix unused-variable compilation error.
llvm-svn: 305898
2017-06-21 11:26:58 +00:00
Ilya Biryukov 200b328972 Moved code hanlding precompiled preamble out of the ASTUnit.
Reviewers: bkramer, krasimir, arphaman, akyrtzi, klimek

Reviewed By: klimek

Subscribers: mgorny, klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D34287

llvm-svn: 305890
2017-06-21 10:24:58 +00:00