aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ASTUnit.cpp
AgeCommit message (Collapse)AuthorFilesLines
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
2014-10-22[modules] Initial support for explicitly loading .pcm files.Richard Smith1-1/+2
Implicit module builds are not well-suited to a lot of build systems. In particular, they fare badly in distributed build systems, and they lead to build artifacts that are not tracked as part of the usual dependency management process. This change allows explicitly-built module files (which are already supported through the -emit-module flag) to be explicitly loaded into a build, allowing build systems to opt to manage module builds and dependencies themselves. This is only the first step in supporting such configurations, and it should be considered experimental and subject to change or removal for now. llvm-svn: 220359
2014-10-15Frontend: Don't accept null DiagnosticsEngines when building ASTUnitsJustin Bogner1-17/+4
The various ways to create an ASTUnit all take a refcounted pointer to a diagnostics engine as an argument, and if it isn't pointing at anything they initialize it. This is a pretty confusing API, and it really makes more sense for the caller to initialize the thing since they control the lifetime anyway. This fixes the one caller that didn't bother initializing the pointer and asserts that the argument is initialized. llvm-svn: 219752
2014-10-14Frontend: Remove some unused arguments in ASTUnit (NFC)Justin Bogner1-5/+4
llvm-svn: 219747
2014-10-03ASTUnit: Replace out parameter with return value, we have NRVO for this.Benjamin Kramer1-22/+22
And elide the copy when pushing the return value into a vector. NFC. llvm-svn: 219001
2014-09-10Unique_ptrify PPCallbacks ownership.Craig Topper1-4/+7
Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
2014-08-29Improve unique_ptr-y ownership in ASTUnit::ComputePreambleDavid Blaikie1-47/+29
Rather than having a pair of pairs and a reference out parameter, build a structure with everything together and named. A raw pointer and a unique_ptr, rather than a raw pointer and a boolean, are used to communicate ownership transfer. It's possible one day we'll end up with a conditional pointer (probably represented by a raw pointer and a boolean) abstraction to use in places like this. Conditional ownership seems to be coming up more often than I'd hoped... llvm-svn: 216712
2014-08-28Don't create a null reference in ASTUnit::LoadFromCommandLine.Alexey Samsonov1-2/+3
This change is the last in the pack of five commits (also see r216691, r216694, r216695, and r216696) that reduces the number of test failures in "check-clang" invocation in UBSan bootstrap from 2443 down to 5. llvm-svn: 216697
2014-08-27Update for LLVM api change.Rafael Espindola1-9/+6
llvm-svn: 216585
2014-08-26Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola1-5/+5
llvm-svn: 216478
2014-08-26Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola1-1/+1
llvm-svn: 216476
2014-08-24Frontend: unique_ptr-ifyDylan Noblesmith1-4/+4
NFC. llvm-svn: 216347
2014-08-18return a std::unique_ptr from getMainBufferWithPrecompiledPreamble. NFC.Rafael Espindola1-19/+22
llvm-svn: 215927
2014-08-18Simplify ASTUnit::Parse a bit by passing a std::unique_ptr to it.Rafael Espindola1-28/+19
llvm-svn: 215900
2014-08-13Small cleanup: Don't duplicate default behavior.Rafael Espindola1-2/+2
std::unique_ptr is null initialized and reset default to null. Thanks to David Blaikie for noticing. llvm-svn: 215560
2014-08-13Use std::unique_ptr to simplify memory management a bit.Rafael Espindola1-12/+6
llvm-svn: 215559
2014-08-12Use StringRef instead of MemoryBuffer&.Rafael Espindola1-2/+2
This code doesn't care where the data it is processing comes from, so a StringRef is probably the most natural interface. llvm-svn: 215448