aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/PrecompiledPreamble.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-01NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151782)James Y Knight1-3/+4
This commit handles the following types: - clang::ExternalASTSource - clang::TargetInfo - clang::ASTContext - clang::SourceManager - clang::FileManager Part of cleanup #151026
2025-07-31NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151545)James Y Knight1-7/+7
Handles clang::DiagnosticsEngine and clang::DiagnosticIDs. For DiagnosticIDs, this mostly migrates from `new DiagnosticIDs` to convenience method `DiagnosticIDs::create()`. Part of cleanup https://github.com/llvm/llvm-project/issues/151026
2025-07-31NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for ↵James Y Knight1-4/+2
llvm::vfs::FileSystem. (#151407) This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>` instead of `FileSystem*` or `FileSystem&`, when dealing with existing objects. Part of cleanup #151026.
2025-07-15[clang][modules] Serialize `CodeGenOptions` (#146422)Jan Svoboda1-3/+5
Some `LangOptions` duplicate their `CodeGenOptions` counterparts. My understanding is that this was done solely because some infrastructure (like preprocessor initialization, serialization, module compatibility checks, etc.) were only possible/convenient for `LangOptions`. This PR implements the missing support for `CodeGenOptions`, which makes it possible to remove some duplicate `LangOptions` fields and simplify the logic. Motivated by https://github.com/llvm/llvm-project/pull/146342.
2025-05-10[clang] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#139399)Kazu Hirata1-1/+1
2025-05-01[clang][frontend] Require invocation to construct `CompilerInstance` (#137668)Jan Svoboda1-3/+2
This PR makes it so that `CompilerInvocation` needs to be provided to `CompilerInstance` on construction. There are a couple of benefits in my view: * Making it impossible to mis-use some `CompilerInstance` APIs. For example there are cases, where `createDiagnostics()` was called before `setInvocation()`, causing the `DiagnosticEngine` to use the default-constructed `DiagnosticOptions` instead of the intended ones. * This shrinks `CompilerInstance`'s state space. * This makes it possible to access **the** invocation in `CompilerInstance`'s constructor (to be used in a follow-up).
2025-03-14[clang][modules] Introduce new `ModuleCache` interface (#131193)Jan Svoboda1-3/+2
This PR adds new `ModuleCache` interface to Clang's implicitly-built modules machinery. The main motivation for this change is to create a second implementation that uses a more efficient kind of `llvm::AdvisoryLock` during dependency scanning. In addition to the lock abstraction, the `ModuleCache` interface also manages the existing `InMemoryModuleCache` instance. I found that compared to keeping these separate/independent, the code is a bit simpler now, since these are two tightly coupled concepts. I can envision a more efficient implementation of the `InMemoryModuleCache` for the single-process case too, which will be much easier to implement with the current setup. This is not intended to be a functional change.
2024-11-13Reapply "[clang] Introduce diagnostics suppression mappings (#112517)"Kadir Cetinkaya1-1/+1
This reverts commit 5f140ba54794fe6ca379362b133eb27780e363d7.
2024-11-12Revert "[clang] Introduce diagnostics suppression mappings (#112517)"Kadir Cetinkaya1-1/+1
This reverts commit 12e3ed8de8c6063b15916b3faf67c8c9cd17df1f. This reverts commit 41e3919ded78d8870f7c95e9181c7f7e29aa3cc4. There are some buildbot breakages in https://lab.llvm.org/buildbot/#/builders/18/builds/6832.
2024-11-12[clang] Introduce diagnostics suppression mappings (#112517)kadir çetinkaya1-1/+1
This implements https://discourse.llvm.org/t/rfc-add-support-for-controlling-diagnostics-severities-at-file-level-granularity-through-command-line/81292. Users now can suppress warnings for certain headers by providing a mapping with globs, a sample file looks like: ``` [unused] src:* src:*clang/*=emit ``` This will suppress warnings from `-Wunused` group in all files that aren't under `clang/` directory. This mapping file can be passed to clang via `--warning-suppression-mappings=foo.txt`. At a high level, mapping file is stored in DiagnosticOptions and then processed with rest of the warning flags when creating a DiagnosticsEngine. This is a functor that uses SpecialCaseLists underneath to match against globs coming from the mappings file. This implies processing warning options now performs IO, relevant interfaces are updated to take in a VFS, falling back to RealFileSystem when one is not available.
2024-06-21[CommandLine] Avoid ManagedStatic.h include (NFC)Nikita Popov1-0/+1
The two variables using ManagedStatic that are exported by this header are not actually used anywhere -- they are used through SubCommand::getTopLevel() and SubCommand::getAll() instead. Drop the extern declarations and the include.
2024-04-03[NFC] [C++20] [Modules] [Reduced BMI] Make sure the size of reduced BMI is ↵Chuanqi Xu1-2/+1
not large than full BMI Before this patch, the size of the reduced BMI may be large than the full BMI when the source codes is pretty small. This violates the design principles. The root cause is an oversight that we skipped something in full BMI but forgot to make it in reduced BMI.
2024-02-08[clang][lex] Always pass suggested module to `InclusionDirective()` callback ↵Jan Svoboda1-1/+2
(#81061) This patch provides more information to the `PPCallbacks::InclusionDirective()` hook. We now always pass the suggested module, regardless of whether it was actually imported or not. The extra `bool ModuleImported` parameter then denotes whether the header `#include` will be automatically translated into import the the module. The main change is in `clang/lib/Lex/PPDirectives.cpp`, where we take care to not modify `SuggestedModule` after it's been populated by `LookupHeaderIncludeOrImport()`. We now exclusively use the `SM` (`ModuleToImport`) variable instead, which has been equivalent to `SuggestedModule` until now. This allows us to use the original non-modified `SuggestedModule` for the callback itself. (This patch turns out to be necessary for https://github.com/apple/llvm-project/pull/8011).
2023-09-08Reapply "[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`"Jan Svoboda1-8/+8
This reapplies ddbcc10b9e26b18f6a70e23d0611b9da75ffa52f, except for a tiny part that was reverted separately: 65331da0032ab4253a4bc0ddcb2da67664bd86a9. That will be reapplied later on, since it turned out to be more involved. This commit is enabled by 5523fefb01c282c4cbcaf6314a9aaf658c6c145f and f0f548a65a215c450d956dbcedb03656449705b9, specifically the part that makes 'clang-tidy/checkers/misc/header-include-cycle.cpp' separator agnostic.
2023-09-06Revert "[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`"Jan Svoboda1-8/+8
This reverts commit ddbcc10b9e26b18f6a70e23d0611b9da75ffa52f. The 'clang-tidy/checkers/misc/header-include-cycle.cpp' test started failing on Windows: https://lab.llvm.org/buildbot/#/builders/216/builds/26855.
2023-09-06[clang] NFCI: Adopt `SourceManager::getFileEntryRefForID()`Jan Svoboda1-8/+8
This commit replaces some calls to the deprecated `FileEntry::getName()` with `FileEntryRef::getName()` by swapping current usages of `SourceManager::getFileEntryForID()` with `SourceManager::getFileEntryRefForID()`. This lowers the number of usages of the deprecated `FileEntry::getName()` from 95 to 50.
2023-09-05[clang] NFCI: Change returned LanguageOptions pointer to referenceJan Svoboda1-1/+1
2023-05-31[clang] NFCI: Use `DirectoryEntryRef` in `PrecompiledPreamble`Jan Svoboda1-5/+5
This removes some uses of the deprecated `DirectoryEntry::getName()`.
2023-03-07[libclang] Add API to override preamble storage pathIgor Kushnir1-7/+20
TempPCHFile::create() calls llvm::sys::fs::createTemporaryFile() to create a file named preamble-*.pch in a system temporary directory. This commit allows overriding the directory where these often many and large preamble-*.pch files are stored. The referenced bug report requests the ability to override the temporary directory path used by libclang. However, overriding the return value of llvm::sys::path::system_temp_directory() was rejected during code review as improper and because it would negatively affect multithreading performance. Finding all places where libclang uses the temporary directory is very difficult. Therefore this commit is limited to override libclang's single known use of the temporary directory. This commit allows to override the preamble storage path only during CXIndex construction to avoid multithreading issues and ensure that all preambles are stored in the same directory. For the same multithreading and consistency reasons, this commit deprecates clang_CXIndex_setGlobalOptions() and clang_CXIndex_setInvocationEmissionPathOption() in favor of specifying these options during CXIndex construction. Adding a new CXIndex constructor function each time a new initialization argument is needed leads to either a large number of function parameters unneeded by most libclang users or to an exponential number of overloads that support different usage requirements. Therefore this commit introduces a new extensible struct CXIndexOptions and a general function clang_createIndexWithOptions(). A libclang user passes a desired preamble storage path to clang_createIndexWithOptions(), which stores it in CIndexer::PreambleStoragePath. Whenever clang_parseTranslationUnit_Impl() is called, it passes CIndexer::PreambleStoragePath to ASTUnit::LoadFromCommandLine(), which stores this argument in ASTUnit::PreambleStoragePath. Whenever ASTUnit::getMainBufferWithPrecompiledPreamble() is called, it passes ASTUnit::PreambleStoragePath to PrecompiledPreamble::Build(). PrecompiledPreamble::Build() forwards the corresponding StoragePath argument to TempPCHFile::create(). If StoragePath is not empty, TempPCHFile::create() stores the preamble-*.pch file in the directory at the specified path rather than in the system temporary directory. The analysis below proves that this passing around of the PreambleStoragePath string is sufficient to guarantee that the libclang user override is used in TempPCHFile::create(). The analysis ignores API uses in test code. TempPCHFile::create() is called only in PrecompiledPreamble::Build(). PrecompiledPreamble::Build() is called only in two places: one in clangd, which is not used by libclang, and one in ASTUnit::getMainBufferWithPrecompiledPreamble(). ASTUnit::getMainBufferWithPrecompiledPreamble() is called in 3 places: ASTUnit::LoadFromCompilerInvocation() [analyzed below]. ASTUnit::Reparse(), which in turn is called only from clang_reparseTranslationUnit_Impl(), which in turn is called only from clang_reparseTranslationUnit(). clang_reparseTranslationUnit() is never called in LLVM code, but is part of public libclang API. This function's documentation requires its translation unit argument to have been built with clang_createTranslationUnitFromSourceFile(). clang_createTranslationUnitFromSourceFile() delegates its work to clang_parseTranslationUnit(), which delegates to clang_parseTranslationUnit2(), which delegates to clang_parseTranslationUnit2FullArgv(), which delegates to clang_parseTranslationUnit_Impl(), which passes CIndexer::PreambleStoragePath to the ASTUnit it creates. ASTUnit::CodeComplete() passes AllowRebuild = false to ASTUnit::getMainBufferWithPrecompiledPreamble(), which makes it return nullptr before calling PrecompiledPreamble::Build(). Both ASTUnit::LoadFromCompilerInvocation() overloads (one of which delegates its work to another) call ASTUnit::getMainBufferWithPrecompiledPreamble() only if their argument PrecompilePreambleAfterNParses > 0. LoadFromCompilerInvocation() is called in: ASTBuilderAction::runInvocation() keeps the default parameter value of PrecompilePreambleAfterNParses = 0, meaning that the preamble file is never created from here. ASTUnit::LoadFromCommandLine(). ASTUnit::LoadFromCommandLine() is called in two places: CrossTranslationUnitContext::ASTLoader::loadFromSource() keeps the default parameter value of PrecompilePreambleAfterNParses = 0, meaning that the preamble file is never created from here. clang_parseTranslationUnit_Impl(), which passes CIndexer::PreambleStoragePath to the ASTUnit it creates. Therefore, the overridden preamble storage path is always used in TempPCHFile::create(). TempPCHFile::create() uses PreambleStoragePath in the same way as LibclangInvocationReporter() uses InvocationEmissionPath. The existing documentation for clang_CXIndex_setInvocationEmissionPathOption() does not specify ownership, encoding, separator or relative vs absolute path requirements. So the documentation for CXIndexOptions::PreambleStoragePath doesn't either. The assumptions are: no ownership transfer; UTF-8 encoding; native separators. Both relative and absolute paths are supported. The added API works as expected in KDevelop: https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283 Fixes: https://github.com/llvm/llvm-project/issues/51847 Differential Revision: https://reviews.llvm.org/D143418
2023-01-14Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-1/+1
2022-12-20[Clang] Prepare for llvm::Optional becoming std::optional.Benjamin Kramer1-1/+1
The needed tweaks are mostly trivial, the one nasty bit is Clang's usage of OptionalStorage. To keep this working old Optional stays around as clang::CustomizableOptional, with the default Storage removed. Optional<File/DirectoryEntryRef> is replaced with a typedef. I tested this with GCC 7.5, the oldest supported GCC I had around. Differential Revision: https://reviews.llvm.org/D140332
2022-12-18Revert "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to ↵Krzysztof Parzyszek1-4/+2
std::optional" This reverts commit 8f0df9f3bbc6d7f3d5cbfd955c5ee4404c53a75d. The Optional*RefDegradesTo*EntryPtr types want to keep the same size as the underlying type, which std::optional doesn't guarantee. For use with llvm::Optional, they define their own storage class, and there is no way to do that in std::optional. On top of that, that commit broke builds with older GCCs, where std::optional was not trivially copyable (static_assert in the clang sources was failing).
2022-12-17[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optionalKrzysztof Parzyszek1-2/+4
2022-05-09[Frontend] when attaching a preamble, don't generate the long predefines buffer.Sam McCall1-0/+4
We know we're going to overwrite it anyway. It'd be a bit of work to coordinate not generating it at all, but setting this flag avoids generating ~10k of the 13k string. Differential Revision: https://reviews.llvm.org/D125180
2022-04-28Frontend: Delete output streams before closing CompilerInstance outputsDuncan P. N. Exon Smith1-1/+1
Delete the output streams coming from CompilerInstance::createOutputFile() and friends once writes are finished. Concretely, replacing `OS->flush()` with `OS.reset()` in: - `ExtractAPIAction::EndSourceFileAction()` - `PrecompiledPreambleAction::setEmittedPreamblePCH()` - `cc1_main()'s support for `-ftime-trace` This fixes theoretical bugs related to proxy streams, which may have cleanups to run in their destructor. For example, a proxy that CompilerInstance sometimes uses is `buffer_ostream`, which wraps a `raw_ostream` lacking pwrite support and adds it. `flush()` does not promise that output is complete; `buffer_ostream` needs to wait until the destructor to forward anything so that it can service later calls to `pwrite()`. If the destructor isn't called then the proxied stream hasn't received any content. This also protects against some logic bugs, triggering a null dereference on a later attempt to write to the stream. No tests, since in practice these particular code paths never use use `buffer_ostream`; you need to be writing a binary file to a pipe (such as stdout) to hit it, but `-extract-api` writes a text file and the other two use computed filenames that will never (in practice) be a pipe. This is effectively NFC, for now. But I have some other patches in the works that add guard rails, crashing if the stream hasn't been destructed by the time the CompilerInstance is told to keep the output file, since in most cases this is a problem. Differential Revision: https://reviews.llvm.org/D124635
2022-04-25[Frontend] shrink in-memory PCH buffers to fitSam McCall1-1/+15
After building a PCH, the vector capacity is on average ~1/3 unused. If we're going to keep it in memory for a while, reallocate to the right size. Take care to do this once clang is destroyed so that we can reuse its memory rather than requesting more. Differential Revision: https://reviews.llvm.org/D124242
2022-04-21Reland [Frontend] avoid copy of PCH data when PrecompiledPreamble stores it ↵Sam McCall1-39/+34
in memory This reverts commit eadf35270727ca743c11b07040bbfedd415ab6dc. The reland fixes a couple of places in clang that were unneccesarily requesting a null-terminated buffer of the PCH, and hitting assertions.
2022-04-21Revert "[Frontend] avoid copy of PCH data when PrecompiledPreamble stores it ↵Sam McCall1-32/+38
in memory" This reverts commit 6e22dac2e2955db1310c63aec215fc22d8da258e. Seems to cause bot failures e.g. https://lab.llvm.org/buildbot/#/builders/109/builds/37071
2022-04-21[Frontend] avoid copy of PCH data when PrecompiledPreamble stores it in memorySam McCall1-38/+32
Instead of unconditionally copying the PCHBuffer into an ostream which can be backed either by a string or a file, just make the PCHBuffer itself the in-memory storage. Differential Revision: https://reviews.llvm.org/D124180
2022-04-21[Frontend] Simplify PrecompiledPreamble::PCHStorage. NFCSam McCall1-164/+110
- Remove fiddly union, preambles are heavyweight - Remove fiddly move constructors in TempPCHFile and PCHStorage, use unique_ptr - Remove unneccesary accessors on PCHStorage - Remove trivial InMemoryStorage - Move implementation details into cpp file This is a prefactoring, followup change will change the in-memory PCHStorage to avoid extra string copies while creating it. Differential Revision: https://reviews.llvm.org/D124177
2022-04-14[clang][lex] NFCI: Use FileEntryRef in PPCallbacks::InclusionDirective()Jan Svoboda1-5/+5
This patch changes type of the `File` parameter in `PPCallbacks::InclusionDirective()` from `const FileEntry *` to `Optional<FileEntryRef>`. With the API change in place, this patch then removes some uses of the deprecated `FileEntry::getName()` (e.g. in `DependencyGraph.cpp` and `ModuleDependencyCollector.cpp`). Reviewed By: dexonsmith, bnbarham Differential Revision: https://reviews.llvm.org/D123574
2021-11-26[clang] Change ordering of PreableCallbacks to make sure PP can be ↵Kirill Bobyrev1-1/+4
referenced in them Currently, BeforeExecute is called before BeginSourceFile which does not allow using PP in the callbacks. Change the ordering to ensure it is possible. This is a prerequisite for D114370. Originated from a discussion with @kadircet. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D114525
2021-04-06[clang][clangd] Avoid inconsistent target creationoToToT1-9/+1
As proposed in D97109, I tried to make target creation consistent in `clang` and `clangd` by replacing the original procedure with a single function introduced in D97493. This also helps `clangd` works with CUDA, OpenMP, etc. Reviewed By: kadircet Differential Revision: https://reviews.llvm.org/D98128
2021-01-25Frontend: Take VFS and MainFileBuffer by reference in ↵Duncan P. N. Exon Smith1-10/+10
PrecompiledPreamble::CanReuse, NFC Clarify that `PrecompiledPreamble::CanReuse` requires non-null arguments for `VFS` and `MainFileBuffer`, taking them by reference instead of by pointer. Differential Revision: https://reviews.llvm.org/D91297
2021-01-21[ASTReader] Allow controlling separately whether validation should be ↵Argyrios Kyrtzidis1-1/+2
disabled for a PCH vs a module file This addresses an issue with how the PCH preable works, specifically: 1. When using a PCH/preamble the module hash changes and a different cache directory is used 2. When the preamble is used, PCH & PCM validation is disabled. Due to combination of #1 and #2, reparsing with preamble enabled can end up loading a stale module file before a header change and using it without updating it because validation is disabled and it doesn’t check that the header has changed and the module file is out-of-date. rdar://72611253 Differential Revision: https://reviews.llvm.org/D95159
2020-12-04ADT: Stop peeking inside AlignedCharArrayUnion, NFCDuncan P. N. Exon Smith1-2/+2
Update all the users of `AlignedCharArrayUnion` to stop peeking inside (to look at `buffer`) so that a follow-up patch can replace it with an alias to `std::aligned_union_t`. This was reviewed as part of https://reviews.llvm.org/D92512, but I'm splitting this bit out to commit first to reduce churn in case the change to `AlignedCharArrayUnion` needs to be reverted for some unexpected reason.
2020-11-11Frontend: Change ComputePreambleBounds to take MemoryBufferRef, NFCDuncan P. N. Exon Smith1-3/+3
Avoid requiring an actual MemoryBuffer in ComputePreambleBounds, when a MemoryBufferRef will do just fine. Differential Revision: https://reviews.llvm.org/D90890
2020-10-20clang/Basic: Replace SourceManager::getMemoryBufferForFile, NFCDuncan P. N. Exon Smith1-5/+6
Replace `SourceManager::getMemoryBufferForFile`, which returned a dereferenceable `MemoryBuffer*` and had a `bool*Invalid` out parameter, with `getMemoryBufferForFileOrNone` (returning `Optional<MemoryBufferRef>`) and `getMemoryBufferForFileOrFake` (returning `MemoryBufferRef`). Differential Revision: https://reviews.llvm.org/D89429
2020-08-10Correctly set CompilingPCH in PrecompilePreambleAction.Adam Czachorowski1-0/+7
This fixes a crash bug in clangd when used with modules. ASTWriter would end up writing references to submodules into the PCH file, but upon reading the submodules would not exists and HeaderFileInfoTrait::ReadData would crash. Differential Revision: https://reviews.llvm.org/D85532
2020-06-12Reland [clangd] Parse std::make_unique, and emit template diagnostics at ↵Sam McCall1-0/+4
expansion. This was originally 658af9435071 and reverted in 665dbe91f2ed. The clang bug this triggered was fixed in 05ed3efc2ac.
2020-06-09Revert "[clangd] Parse std::make_unique, and emit template diagnostics at ↵Sam McCall1-4/+0
expansion." This reverts commit 658af9435071d5da017c1d65298bdea19ec095e1. Breaks tests on windows: http://45.33.8.238/win/17229/step_9.txt I think this is uncovering a latent bug when a late-parsed preamble is used with an eagerly-parsed file.
2020-06-09[clangd] Parse std::make_unique, and emit template diagnostics at expansion.Sam McCall1-0/+4
Summary: Parsing std::make_unique is an exception to the usual non-parsing of function bodies in the preamble. (A hook is added to PreambleCallbacks to allow this). This allows us to diagnose make_unique<Foo>(wrong arg list), and opens the door to providing signature help (by detecting where the arg list is forwarded to). This function is trivial (checked libc++ and libstdc++) and doesn't result in any extra templates being instantiated, so this should be cheap. This uncovered a second issue (already visible with class templates)... Errors produced by template instantiation have primary locations within the template, with instantiation stack reported as notes. For templates defined in headers, these end up reported at the #include directive, which isn't terribly helpful as the header itself is probably fine. This patch reports them at the instantiation site (the first location in the instantiation stack that's in the main file). This in turn required a bit of refactoring in Diagnostics so we can delay relocating the diagnostic until all notes are available. https://github.com/clangd/clangd/issues/412 Reviewers: hokein, aaron.ballman Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D81351
2020-06-08[Preamble] Invalidate preamble when missing headers become present.Sam McCall1-4/+97
Summary: To avoid excessive extra stat()s, only check the possible locations of headers that weren't found at all (leading to a compile error). For headers that *were* found, we don't check for files earlier on the search path that could override them. Reviewers: kadircet Subscribers: javed.absar, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77942
2020-04-16[clang] Const correct ComputePreambleBoundsKadir Cetinkaya1-1/+1
2020-03-11Avoid including FileManager.h from SourceManager.hReid Kleckner1-0/+1
Most clients of SourceManager.h need to do things like turning source locations into file & line number pairs, but this doesn't require bringing in FileManager.h and LLVM's FS headers. The main code change here is to sink SM::createFileID into the cpp file. I reason that this is not performance critical because it doesn't happen on the diagnostic path, it happens along the paths of macro expansion (could be hot) and new includes (less hot). Saves some includes: 309 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileManager.h 272 - /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileSystemOptions.h 271 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h 267 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/FileSystem.h 266 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Chrono.h Differential Revision: https://reviews.llvm.org/D75406
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer1-5/+6
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2019-11-27[Frontend] Clean up some dead code in PrecompiledPreamble. NFCSam McCall1-14/+3
2019-08-14[Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere1-2/+2
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
2019-08-07Remove LLVM mutexes from clang in favor of std::mutexBenjamin Kramer1-5/+4
None of those need to be recursive mutexes. No functionality change intended. llvm-svn: 368173
2019-08-07Replace llvm::MutexGuard/UniqueLock with their standard equivalentsBenjamin Kramer1-4/+4
All supported platforms have <mutex> now, so we don't need our own copies any longer. No functionality change intended. llvm-svn: 368149