aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-11-08Bitcode: Decouple block info block state from reader.Peter Collingbourne1-7/+7
As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html Move block info block state to a new class, BitstreamBlockInfo. Clients may set the block info for a particular cursor with the BitstreamCursor::setBlockInfo() method. At this point BitstreamReader is not much more than a container for an ArrayRef<uint8_t>, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 llvm-svn: 286207
2016-11-02Bitcode: Change reader interface to take memory buffers.Peter Collingbourne1-4/+3
As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106595.html This change also fixes an API oddity where BitstreamCursor::Read() would return zero for the first read past the end of the bitstream, but would report_fatal_error for subsequent reads. Now we always report_fatal_error for all reads past the end. Updated clients to check for the end of the bitstream before reading from it. I also needed to add padding to the invalid bitcode tests in test/Bitcode/. This is because the streaming interface was not checking that the file size is a multiple of 4. Differential Revision: https://reviews.llvm.org/D26219 llvm-svn: 285773
2016-08-17Support object-file-wrapped modules in clang -module-file-info.Adrian Prantl1-13/+17
rdar://problem/24504815 llvm-svn: 279004
2016-07-15Frontend: Simplify ownership model for clang's output streams.Peter Collingbourne1-15/+14
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-06-24Use more ArrayRefsDavid Majnemer1-2/+2
No functional change is intended, just a small refactoring. llvm-svn: 273647
2016-05-27Apply clang-tidy's misc-move-constructor-init throughout Clang.Benjamin Kramer1-1/+2
No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270996
2016-05-03[modules][debuginfo] Only include imported modules when targeting LLDBDavid Blaikie1-0/+1
These constructs are only applicable to a debugger capable of loading a Clang AST, so omit them for brevity when not doing so. We could potentially propagate more of CodeGenOptions through the ObjectFilePCGContainerOperations for consistency (so the next person who adds some CodeGenOpts feature that tweaks debug info output doesn't get caught by this), so I'm open to objections/alternatives there, but went with this for now. Tested just a couple of basic cases (one direct, one indirect (through the ObjectFilePCHContainerOperations) & fixed up other cases to pass the -debugger-tuning flag as appropriate. llvm-svn: 268460
2016-04-08revert SVN r265702, r265640Saleem Abdulrasool1-2/+1
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: move CodeGenOptions from FrontendSaleem Abdulrasool1-1/+2
This is a mechanical move of CodeGenOptions from libFrontend to libBasic. This fixes the layering violation introduced earlier by threading CodeGenOptions into TargetInfo. It should also fix the modules based self-hosting builds. NFC. llvm-svn: 265702
2016-03-07Module Debugging: Fix a crash when emitting debug info for nested tag typesAdrian Prantl1-0/+9
whose DeclContext is not yet complete by deferring their emission. rdar://problem/24918680 llvm-svn: 262851
2016-03-04Make TargetInfo store an actual DataLayout instead of a string.James Y Knight1-6/+6
Use it to calculate UserLabelPrefix, instead of specifying it (often incorrectly). Note that the *actual* user label prefix has always come from the DataLayout, and is handled within LLVM. The main thing clang's TargetInfo::UserLabelPrefix did was to set the #define value. Having these be different from each-other is just silly. Differential Revision: http://reviews.llvm.org/D17183 llvm-svn: 262737
2016-02-02Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer1-1/+1
from Driver to Frontend. llvm-svn: 259489
2016-01-22Module Debugging: Canonicalize the file names used as PCH module namesAdrian Prantl1-4/+8
by stripping the path. Follow-up to r258555. This is safe because only one PCH per CU is currently supported for module debugging. rdar://problem/24301262 llvm-svn: 258582
2016-01-22Module debugging: Create a parent DIModule with the PCH name for typesAdrian Prantl1-1/+5
emitted into a precompiled header to mirror the debug info emitted for object files importing the PCH. rdar://problem/24290667 llvm-svn: 258555
2016-01-22Fix the build by using the correct suffix for 64 bit literalsAdrian Prantl1-1/+1
llvm-svn: 258531
2016-01-22Fix a typo in r258507 and change the PCH dwoid constant to ~1UL.Adrian Prantl1-1/+1
rdar://problem/24290667 llvm-svn: 258519
2016-01-22Module Debugging: Use a nonzero DWO id for precompiled headers.Adrian Prantl1-1/+5
PCH files don't have a module signature and LLVM uses a nonzero DWO id as an indicator for skeleton / module CUs. This change pins the DWO id for PCH files to a known constant value. The correct long-term solution here is to implement a module signature that is an actual dterministic hash (at the moment module signatures are just random nonzero numbers) and then enable this for PCH files as well. <rdar://problem/24290667> llvm-svn: 258507
2016-01-19Module Debugging: Make sure that anonymous tag decls that define globalAdrian Prantl1-7/+6
variables are visited. This shouldn't encourage anyone to put global variables into clang modules. rdar://problem/24199640 llvm-svn: 258250
2016-01-19Module Debugging: Defer the emission of anonymous tag declsAdrian Prantl1-0/+4
until we are visiting their declcontext. This fixes a regression introduced in r256962: When building debug info for a typdef'd anonymous tag type, we would be visiting the inner anonymous type first thus creating a "typedef changes linkage of anonymous type, but linkage was already computed" error. rdar://problem/24199640 llvm-svn: 258152
2016-01-06Module debugging: Defer emitting tag types until their definitionAdrian Prantl1-3/+16
was visited and all decls have been merged. We only get a single chance to emit the types for virtual classes because CGDebugInfo::completeRequiredType() categorically doesn't complete them. llvm-svn: 256962
2015-10-23Module Debugging: Emit module debug info for types inside of Objective-CAdrian Prantl1-0/+4
containers. rdar://problem/23196170 llvm-svn: 251120
2015-10-23Remove a redundant check. NFCAdrian Prantl1-2/+1
llvm-svn: 251116
2015-09-22Module Debugging: Use the clang module signature as the module's dwo_idAdrian Prantl1-1/+1
when building a module. Clang already records the module signature when building a skeleton CU to reference a clang module. Matching the id in the skeleton with the one in the module allows a DWARF consumer to verify that they found the correct version of the module without them needing to know about the clang module format. llvm-svn: 248345
2015-09-21Debug Info: When building a module, emit skeleton CUs for imported modules.Adrian Prantl1-0/+7
llvm-svn: 248184
2015-09-20Module debugging: Support submodules in the PCM/PCH debug info.Adrian Prantl1-0/+5
llvm-svn: 248127
2015-09-19Further simplify the interface of PCHContainerGeneratorAdrian Prantl1-7/+7
by dropping the const qualifier on the CI. NFC llvm-svn: 248101
2015-09-19Eliminate a redundant check.Adrian Prantl1-3/+2
llvm-svn: 248068
2015-09-18Simplify the interface of PCHContainerGenerator and friendsAdrian Prantl1-13/+12
by passing in a CompilerInstance instead of all its individual members. NFC. llvm-svn: 248053
2015-09-10Debug Info: Remove an unnecessary debug type visitor.Adrian Prantl1-7/+0
Thanks to dblaikie for spotting this. llvm-svn: 247303
2015-09-10Re-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor ↵Hans Wennborg1-3/+3
fixes" This never broke the build; it was the LLVM side, r247216, that caused problems. llvm-svn: 247302
2015-09-10Revert r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes"Hans Wennborg1-3/+3
Seems it broke the Polly build. From http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-fast/builds/11687/steps/compile/logs/stdio: In file included from /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/lib/TableGen/Record.cpp:14:0: /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/include/llvm/TableGen/Record.h:369:3: error: looser throw specifier for 'virtual llvm::TypedInit::~TypedInit()' /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/include/llvm/TableGen/Record.h:270:11: error: overriding 'virtual llvm::Init::~Init() noexcept (true)' llvm-svn: 247222
2015-09-10Fix Clang-tidy misc-use-override warnings, other minor fixesHans Wennborg1-3/+3
Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D12741 llvm-svn: 247218
2015-09-08Module Debugging: Emit debug type information into clang ObjC modules.Adrian Prantl1-0/+42
When -fmodule-format is set to "obj", emit debug info for all types declared in a module or referenced by a declaration into the module's object file container. This patch adds support for Objective-C types and methods. llvm-svn: 247068
2015-09-08Module Debugging: Emit debug type information into clang modules.Adrian Prantl1-0/+58
When -fmodule-format is set to "obj", emit debug info for all types declared in a module or referenced by a declaration into the module's object file container. This patch adds support for C and C++ types. llvm-svn: 247049
2015-08-27Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1Adrian Prantl1-0/+1
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-08-18Initialize the AST consumer as soon as we have both an ASTConsumer and anRichard Smith1-4/+1
ASTContext. Fixes some cases where we could previously initialize the AST consumer more than once. llvm-svn: 245346
2015-08-13Remove and forbid raw_svector_ostream::flush() calls.Yaron Keren1-1/+0
After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
2015-08-09[modules] PR22534: Load files specified by -fmodule-file= eagerly. In ↵Richard Smith1-1/+6
particular, this avoids the need to re-parse module map files when using such a module. llvm-svn: 244416
2015-08-05Rename DescriptionString -> DataLayoutString as it matches the actualEric Christopher1-4/+4
use of the string. llvm-svn: 244178
2015-07-24LLVM API Change: the Module always owns the DataLayoutMehdi Amini1-3/+2
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 243115
2015-07-17Make the clang module container format selectable from the command line.Adrian Prantl1-2/+2
- 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-09Rename ModuleContainerGenerator to PCHContainergenerator for consistencyAdrian Prantl1-28/+29
and re-clang-format (NFC). llvm-svn: 241841
2015-07-08Revert "Revert r241620 and follow-up commits" and move the initializationAdrian Prantl1-0/+192
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. llvm-svn: 241653
2015-07-07Revert r241620 and follow-up commits while investigating linux buildbot ↵Adrian Prantl1-199/+0
failures. llvm-svn: 241642
2015-07-07Cleanup: Use the C++ API to initialize the backend.Adrian Prantl1-4/+5
llvm-svn: 241635
2015-07-07Wrap clang modules and pch files in an object file container.Adrian Prantl1-0/+198
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend to put the contents of a PCH into a __clangast section inside a COFF, ELF, or Mach-O object file container. This is done to facilitate module debugging by makeing it possible to store the debug info for the types defined by a module alongside the AST. rdar://problem/20091852 llvm-svn: 241620