aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ASTUnit.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-11-09[VFS] Replace TimeValue usage with std::chronoPavel Labath1-3/+4
Summary: NFCI Reviewers: benlangmuir, zturner Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25948 llvm-svn: 286356
2016-08-26C++ Modules TS: add frontend support for building pcm files from moduleRichard Smith1-1/+1
interface files. At the moment, all declarations (and no macros) are exported, and 'export' declarations are not supported yet. llvm-svn: 279794
2016-08-25Refactor to remove the assumption that we know the name of the module we're ↵Richard Smith1-1/+1
emitting at the point when we create a PCHGenerator (with the C++ modules TS, we find that out part way through parsing the input). llvm-svn: 279766
2016-08-18Module: add -fprebuilt-module-path to support loading prebuilt modules.Manman Ren1-0/+1
In this mode, there is no need to load any module map and the programmer can simply use "@import" syntax to load the module directly from a prebuilt module path. When loading from prebuilt module path, we don't support rebuilding of the module files and we ignore compatible configuration mismatches. rdar://27290316 Differential Revision: http://reviews.llvm.org/D23125 llvm-svn: 279096
2016-07-18[NFC] Header cleanupMehdi Amini1-1/+0
Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
2016-07-15Frontend: Simplify ownership model for clang's output streams.Peter Collingbourne1-6/+7
This changes the CompilerInstance::createOutputFile function to return a std::unique_ptr<llvm::raw_ostream>, rather than an llvm::raw_ostream implicitly owned by the CompilerInstance. This in most cases required that I move ownership of the output stream to the relevant ASTConsumer. The motivation for this change is to allow BackendConsumer to be a client of interfaces such as D20268 which take ownership of the output stream. Differential Revision: http://reviews.llvm.org/D21537 llvm-svn: 275507
2016-07-13[PCH/preamble] Make sure that if the preamble/PCH was serialized with errors ↵Argyrios Kyrtzidis1-1/+2
that we set diagnostic engine state appropriately. Otherwise there can be a crash with CFG analysis warnings doing work on invalid AST. Fixes crash of rdar://26224134 llvm-svn: 275313
2016-06-12Add some std::move where the value is only read otherwise.Benjamin Kramer1-7/+8
This mostly affects smart pointers. No functionality change intended. llvm-svn: 272520
2016-05-17[PCH] Fixed bug with preamble invalidation when overridden files changeCameron Desrochers1-13/+23
When remapped files were changed, they would not always cause the preamble's PCH to be invalidated, because the remapped path didn't necessarily match the include path (e.g. slash direction -- this happens a lot on Windows). I fixed this by moving to a llvm::sys::fs::UniqueID-based map instead of comparing paths stringwise. Differential Revision: http://reviews.llvm.org/D20137 llvm-svn: 269769
2016-04-08revert SVN r265702, r265640Saleem Abdulrasool1-8/+4
Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
2016-04-07Basic: thread CodeGenOptions into TargetInfoSaleem Abdulrasool1-4/+8
This threads CodeGenOptions into the TargetInfo hierarchy. This is motivated by ARM which can change some target information based on the EABI selected (-meabi). Similar options exist for other platforms (e.g. MIPS) and thus is generally useful. NFC. llvm-svn: 265640
2016-03-25Delete dead variable.Richard Smith1-3/+1
llvm-svn: 264464
2016-02-19[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a singleRichard Smith1-1/+1
option. Previously these options could both be used to specify that you were compiling the implementation file of a module, with a different set of minor bugs in each case. This change removes -fmodule-implementation-of, and instead tracks a flag to determine whether we're currently building a module. -fmodule-name now behaves the same way that -fmodule-implementation-of previously did. llvm-svn: 261372
2016-02-09[ASTUnit] Change the parameter of ASTUnit::LoadFromCompilerInvocationAction ↵Argyrios Kyrtzidis1-2/+2
to accept a more general FrontendAction. llvm-svn: 260251
2015-12-15[libclang] Add a flag to create the precompiled preamble on the first parse.Benjamin Kramer1-16/+19
Summary: The current default is to create the preamble on the first reparse, aka second parse. This is useful for clients that do not want to block when opening a file because serializing the preamble takes a bit of time. However, this makes the reparse much more expensive and that may be on the critical path as it's the first interaction a user has with the source code. YouCompleteMe currently optimizes for the first code interaction by parsing the file twice when loaded. That's just unnecessarily slow and this flag helps to avoid that. Reviewers: doug.gregor, klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15490 llvm-svn: 255635
2015-11-20[libclang] Make sure to use the raw module format for libclang parsing.Argyrios Kyrtzidis1-0/+4
Fixes crash when passing '-gmodules' in the compiler options. rdar://23588717 llvm-svn: 253645
2015-11-03Introduce module file extensions to piggy-back data onto module files.Douglas Gregor1-3/+4
Introduce the notion of a module file extension, which introduces additional information into a module file at the time it is built that can then be queried when the module file is read. Module file extensions are identified by a block name (which must be unique to the extension) and can write any bitstream records into their own extension block within the module file. When a module file is loaded, any extension blocks are matched up with module file extension readers, that are per-module-file and are given access to the input bitstream. Note that module file extensions can only be introduced by programmatic clients that have access to the CompilerInvocation. There is only one such extension at the moment, which is used for testing the module file extension harness. As a future direction, one could imagine allowing the plugin mechanism to introduce new module file extensions. llvm-svn: 251955
2015-10-20Roll-back r250822.Angel Garcia Gomez1-1/+1
Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
2015-10-20Apply modernize-use-default to clang.Angel Garcia Gomez1-1/+1
Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
2015-10-06Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg1-6/+6
minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
2015-10-06[Tooling] Reuse FileManager in ASTUnit.Benjamin Kramer1-13/+9
ASTUnit was creating multiple FileManagers and throwing them away. Reuse the one from Tooling. No functionality change now but necessary for VFSifying tooling. llvm-svn: 249410
2015-08-27Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1Adrian Prantl1-5/+5
to enable the use of external type references in the debug info (a.k.a. module debugging). The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs" and passes that to cc1. All this does at the moment is set a flag codegenopts. http://reviews.llvm.org/D11958 llvm-svn: 246192
2015-07-25[Modules] Wrap the main ModuleManager visitor in a function_ref.Benjamin Kramer1-29/+19
Avoids the awkward passing of an opaque void *UserData argument. No functional change intended. llvm-svn: 243213
2015-07-17Make the clang module container format selectable from the command line.Adrian Prantl1-3/+3
- introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
2015-07-07[libclang] Replace ObjC generic parameters in code-completion results.Douglas Gregor1-3/+4
rdar://19369529 llvm-svn: 241557
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-3/+3
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-3/+3
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-20Introduce a PCHContainerOperations interface (NFC).Adrian Prantl1-42/+67
A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
2015-05-29Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer1-1/+1
If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
2015-04-10Return a pointer instead of having a pointer outparam and a bool return.Rafael Espindola1-3/+3
llvm-svn: 234590
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-3/+3
Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
2015-03-14[modules] Teach the AST reader to handle the case of importing a moduleChandler Carruth1-2/+2
with a subset of the existing target CPU features or mismatched CPU names. While we can't check that the CPU name used to build the module will end up being able to codegen correctly for the translation unit, we actually check that the imported features are a subset of the existing features. While here, rewrite the code to use std::set_difference and have it diagnose all of the differences found. Test case added which walks the set relationships and ensures we diagnose all the right cases and accept the others. No functional change for implicit modules here, just better diagnostics. llvm-svn: 232248
2015-03-03[ASTUnit] Fix crash when trying to load a module file via ↵Argyrios Kyrtzidis1-5/+7
ASTUnit::LoadFromASTFile. rdar://19997358 llvm-svn: 231060
2015-02-25Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-16/+2
llvm-svn: 230454
2015-02-25Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+16
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
2015-02-24Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-16/+2
This reverts commit r230305. Off to fix another round of missing dependencies on various platforms. llvm-svn: 230309
2015-02-24Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+16
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 3. llvm-svn: 230305
2015-02-21Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-16/+2
This reverts commit 230099. The Linux configure+make build variant still needs some work. llvm-svn: 230103
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+16
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 2. llvm-svn: 230089
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-16/+2
This reverts commit r230067. Investigating another batch of problems found by the bots. llvm-svn: 230073
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+16
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. llvm-svn: 230067
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-16/+2
This reverts commit r230044 while dealing with buildbot breakage. Conflicts: test/Modules/module_container.m llvm-svn: 230052
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+16
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 llvm-svn: 230044
2015-02-06ASTUnit: Fix a name clash in GCC builds.Benjamin Kramer1-2/+2
Should fix the build. Looks like GCC 4.9 is using different scoping rules for range-based for loops. llvm-svn: 228424
2015-02-06ASTUnit: Use range-based for loops.Benjamin Kramer1-91/+69
llvm-svn: 228420
2015-02-06Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer1-8/+6
Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
2014-11-17Make DiagnosticsEngine::takeClient return std::unique_ptr<>Alexander Kornienko1-6/+6
Summary: Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated callers to store conditional ownership using a pair of pointer and unique_ptr instead of a pointer + bool. Updated code that temporarily registers clients to use the non-owning registration (+ removed extra calls to takeClient). Reviewers: dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6294 llvm-svn: 222193
2014-10-31[libclang] Disable spell-checking and warnings during code-completion since ↵Argyrios Kyrtzidis1-0/+4
they are not needed. llvm-svn: 220966
2014-10-31[modules] When a .pcm file is explicitly built separately from the translationRichard Smith1-2/+2
unit, allow the -O settings of the two compilations to differ. llvm-svn: 220943
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-1/+6
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657