aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization
AgeCommit message (Collapse)AuthorFilesLines
2014-12-27Objective-C: Serialize "more than one decl" state of ObjCMethodList.Nico Weber3-14/+34
This fixes PR21587, what r221933 fixed for regular programs is now also fixed for decls coming from PCH files. Use another bit from the count/bits uint16_t for storing the "more than one decl" bit. This reduces the number of bits for the count from 14 to 13. The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits should still be plenty. Since this changes the meaning of a serialized bit pattern, also increase clang::serialization::VERSION_MAJOR. Storing the "more than one decl" state of only the first overload isn't quite correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at the state of the first overload so it's good enough for now. llvm-svn: 224892
2014-12-27Address review feedback on r221933.Nico Weber2-21/+21
Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in the low bit of the ObjCMethodDecl pointer, using a PointerIntPair. Most of this patch is replacing ".Method" with ".getMethod()". No intended behavior change. llvm-svn: 224876
2014-12-16Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev3-3/+4
Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
2014-12-15First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2-0/+18
the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 llvm-svn: 224233
2014-12-11[modules] When constructing paths relative to a module, strip out /./ directoryRichard Smith1-15/+19
components. These sometimes get synthetically added, and we don't want -Ifoo and -I./foo to be treated fundamentally differently here. llvm-svn: 224055
2014-12-06[modules] If we import a module, and we've seen a module map that describes theRichard Smith1-2/+24
module, use the path from the module map file in preference to the path from the .pcm file when resolving relative paths in the .pcm file. This allows diagnostics (and .d output) to give relative paths if the module was found via a relative path. llvm-svn: 223577
2014-12-05[modules] Instead of storing absolute paths in a .pcm file, store the path toRichard Smith3-142/+187
the root of the module and use paths relative to that directory wherever possible. This is a step towards allowing explicit modules to be relocated without being rebuilt, which is important for some kinds of distributed builds, for good paths in diagnostics, and for appropriate .d output. This is a recommit of r223443, reverted in r223465; when joining together imported file paths, we now use the system's separator rather than always using '/'. This avoids path mismatches between the original module build and the module user on Windows (at least, in some cases). A more comprehensive fix will follow. llvm-svn: 223539
2014-12-05Temporarily reverting r223443 due to bot breakage.Aaron Ballman3-187/+140
llvm-svn: 223465
2014-12-05[modules] Instead of storing absolute paths in a .pcm file, store the path toRichard Smith3-140/+187
the root of the module and use paths relative to that directory wherever possible. This is a step towards allowing explicit modules to be relocated without being rebuilt, which is important for some kinds of distributed builds, for good paths in diagnostics, and for appropriate .d output. llvm-svn: 223443
2014-12-02Try to fix the MSVC build.Hans Wennborg1-3/+2
llvm-svn: 223105
2014-12-02[modules] Track how 'header' directives were written in module map files,Richard Smith2-13/+26
rather than trying to extract this information from the FileEntry after the fact. This has a number of beneficial effects. For instance, diagnostic messages for failed module builds give a path relative to the "module root" rather than an absolute file path, and the contents of the module includes file is no longer dependent on what files the including TU happened to inspect prior to triggering the module build. llvm-svn: 223095
2014-11-21[modules] When explicitly importing a module, it's fine for the imported moduleRichard Smith1-0/+7
to be newer than we were expecting. That happens if .pcm's get moved between file systems during a distributed build. (It's still not OK for them to actually be different, though, so we still check the size and signature matches.) llvm-svn: 222507
2014-11-21PR21323: Fix iterator invalidation issue when looking for redeclarations of aRichard Smith1-3/+8
special member function. No test yet: the only testcases we have for this issue are extremely complex. Testcase will be added once I get a reasonable reduction. llvm-svn: 222506
2014-11-19Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie3-4/+4
pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
2014-11-18[OPENMP] Additional processing of 'omp atomic read' directive.Alexey Bataev2-0/+6
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic read' is allowed to be used only for expression statements of form 'v = x;', where x and v (as applicable) are both l-value expressions with scalar type. Patch adds checks for it. llvm-svn: 222231
2014-11-18[ASTReader] Add a convenience function to retrieve all the input files of a ↵Argyrios Kyrtzidis1-0/+8
module file. llvm-svn: 222224
2014-11-13PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith1-4/+2
is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
2014-11-12Update for llvm api change.Rafael Espindola1-1/+1
llvm-svn: 221786
2014-11-12Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.Rafael Espindola2-6/+3
llvm-svn: 221784
2014-11-11[OPENMP] Codegen for threadprivate variablesAlexey Bataev3-2/+20
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>); Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info. Differential Revision: http://reviews.llvm.org/D4002 llvm-svn: 221663
2014-11-10Validate user headers even if -fmodules-validate-once-per-build-sessionBen Langmuir1-3/+2
is enabled. Unlike system headers, we want to be more careful about modifications to user headers, because it's still easy to edit a header while you're building. llvm-svn: 221634
2014-11-08[c++1z] N4295: fold-expressions.Richard Smith2-1/+26
This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
2014-11-08Check module signature when the module has already been loadedBen Langmuir1-7/+13
We may need to verify the signature on subsequent imports as well, just like we verify the size/modtime: @import A; @import B; // imports A @import C; // imports A llvm-svn: 221569
2014-11-08Fix unintended fallthrough in ASTReaderBen Langmuir1-0/+2
llvm-svn: 221567
2014-11-07Introduce a SanitizerKind enum to LangOptions.Alexey Samsonov2-3/+5
Use the bitmask to store the set of enabled sanitizers instead of a bitfield. On the negative side, it makes syntax for querying the set of enabled sanitizers a bit more clunky. On the positive side, we will be able to use SanitizerKind to eventually implement the new semantics for -fsanitize-recover= flag, that would allow us to make some sanitizers recoverable, and some non-recoverable. No functionality change. llvm-svn: 221558
2014-10-31Remove CastKind typedef from CastExpr since CastKind is in the clang namespace.Craig Topper1-1/+1
llvm-svn: 220955
2014-10-31[modules] When a .pcm file is explicitly built separately from the translationRichard Smith1-18/+47
unit, allow the -O settings of the two compilations to differ. llvm-svn: 220943
2014-10-29Improved capturing variable-length array types in CapturedStmt.Alexey Bataev1-1/+1
An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas. This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP. Differential Revision: http://reviews.llvm.org/D5099 llvm-svn: 220850
2014-10-28Objective-C. revert patch for rdar://17554063.Fariborz Jahanian2-4/+0
llvm-svn: 220812
2014-10-28[modules] Allow -I, -D, -W flags to change between building a module andRichard Smith1-3/+18
explicitly using the resulting .pcm file. Unlike for an implicit module build, we don't need nor want to require these flags to match between the module and its users. llvm-svn: 220780
2014-10-27Remove unused variable.Richard Smith1-2/+1
llvm-svn: 220738
2014-10-27[modules] Load .pcm files specified by -fmodule-file lazily.Richard Smith1-0/+19
llvm-svn: 220731
2014-10-27Add the initial TypoExpr AST node for delayed typo correction.Kaelyn Takata2-0/+10
llvm-svn: 220692
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer3-29/+23
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-10-24[modules] Support combining 'textual' with 'private'.Richard Smith2-51/+34
llvm-svn: 220589
2014-10-24[Modules] Free modules that failed signature verification.Benjamin Kramer1-0/+1
The control flow and ownership is weird enough so unique_ptr doesn't help here :( llvm-svn: 220569
2014-10-23[modules] Simplify reading of INPUT_FILE_OFFSETS record and make it robust ↵Richard Smith1-7/+7
against changes to record order. llvm-svn: 220524
2014-10-23Factor out common checks from module map deserialization. No functionality ↵Richard Smith1-110/+17
change. llvm-svn: 220521
2014-10-23Add a "signature" to AST files to verify that they haven't changedBen Langmuir5-3/+79
Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs) is not stable, it is not safe to load an AST file that depends on another AST file that has been rebuilt since the importer was built, even if "nothing changed". We previously used size and modtime to check this, but I've seen cases where a module rebuilt quickly enough to foil this check and caused very hard to debug build errors. To save cycles when we're loading the AST, we just generate a random nonce value and check that it hasn't changed when we load an imported module, rather than actually hash the whole file. This is slightly complicated by the fact that we need to verify the signature inside addModule, since we might otherwise consider that a mdoule is "OutOfDate" when really it is the importer that is out of date. I didn't see any regressions in module load time after this change. llvm-svn: 220493
2014-10-22[modules] Add support for 'textual header' directives.Richard Smith1-1/+13
This allows a module to specify that it logically contains a file, but that said file is non-modular and intended for textual inclusion. This allows layering checks to work properly in the presence of such files. llvm-svn: 220448
2014-10-22Removing the setLBracLoc and setRBracLoc functions from CompoundStmt -- ↵Aaron Ballman1-2/+2
their only use was with the AST reader, and friendship can be used to handle that. Drive-by rename of "Brac" to "Brace" for the private data members. NFC. llvm-svn: 220428
2014-10-22[modules] Initial support for explicitly loading .pcm files.Richard Smith3-24/+41
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-21[modules] When building an injected-class-name type, we may have to insert itRichard Smith1-6/+11
into multiple merged classes' TypeForDecl slots. llvm-svn: 220331
2014-10-21[OPENMP] Codegen for 'private' clause in 'parallel' directive.Alexey Bataev2-1/+9
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables. Differential Revision: http://reviews.llvm.org/D4752 llvm-svn: 220262
2014-10-20Revert most of r215810, which is no longer neededBen Langmuir1-24/+15
Now that we no longer add mappings when there are no local entities, there is no need to always bump the size of the tables that correspond to ContinuousRangeMaps. llvm-svn: 220208
2014-10-20Don't add ID mappings for offsets with no entities in a moduleBen Langmuir2-45/+50
This is a better fix for 'duplicate key' problems in module continuous range maps (vs what I added in r215810) by not adding any mappings at all when there are no local entities. Now it also covers selectors, which were not always being bumped because the record SELECTOR_OFFSET is not always emitted. I'll back out most of r215810 in a future commit, since it should no longer be needed. llvm-svn: 220207
2014-10-17Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarityDavid Blaikie1-1/+1
Code review feedback from Richard Smith on r219900. llvm-svn: 220060
2014-10-16PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, ↵David Blaikie2-3/+2
reference-ness, etc) for non-type template parameters Plumb through the full QualType of the TemplateArgument::Declaration, as it's insufficient to only know whether the type is a reference or pointer (that was necessary for mangling, but insufficient for debug info). This shouldn't increase the size of TemplateArgument as TemplateArgument::Integer is still longer by another 32 bits. Several bits of code were testing that the reference-ness of the parameters matched, but this seemed to be insufficient (various other features of the type could've mismatched and wouldn't've been caught) and unnecessary, at least insofar as removing those tests didn't cause anything to fail. (Richard - perchaps you can hypothesize why any of these checks might need to test reference-ness of the parameters (& explain why reference-ness is part of the mangling - I would've figured that for the reference-ness to be different, a prior template argument would have to be different). I'd be happy to add them in/beef them up and add test cases if there's a reason for them) llvm-svn: 219900
2014-10-14[modules] Merging for class-scope using-declarations.Richard Smith1-0/+68
llvm-svn: 219657
2014-10-11Fix deserialization of PredefinedExpr in dependent context.Alexey Bataev1-1/+1
llvm-svn: 219561