Sebastian Redl
3462779369
Allow loading declarations from any file in the chain. WIP
...
llvm-svn: 108956
2010-07-20 22:46:15 +00:00
Sebastian Redl
837a6cbe03
Allow loading types from any file in the chain. WIP
...
llvm-svn: 108954
2010-07-20 22:37:49 +00:00
Sebastian Redl
0675030cf9
Allow loading source locations from any file in the chain. WIP
...
llvm-svn: 108942
2010-07-20 21:50:20 +00:00
Sebastian Redl
b293a45d28
More work on getting PCHReader to handle multiple files. Promote SLocOffsets to per-file data. WIP
...
llvm-svn: 108930
2010-07-20 21:20:32 +00:00
Douglas Gregor
af82e3510b
Introduce a new lexer function to compute the "preamble" of a file,
...
which is the part of the file that contains all of the initial
comments, includes, and preprocessor directives that occur before any
of the actual code. Added a new -print-preamble cc1 action that is
only used for testing.
llvm-svn: 108913
2010-07-20 20:18:03 +00:00
Argyrios Kyrtzidis
dde5790562
Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce
...
FunctionTemplateDecl::findSpecialization.
Redeclarations of specializations will not cause the previous decl to be removed from the set,
the set will keep the canonical decl. findSpecialization will return the most recent redeclaration.
llvm-svn: 108834
2010-07-20 13:59:58 +00:00
Argyrios Kyrtzidis
c1624e9eda
Whether the specialization should be added to template's folding set when read from PCH,
...
is determined by a isCanonicalDecl check.
llvm-svn: 108833
2010-07-20 13:59:40 +00:00
Sebastian Redl
c57d34bc35
Update ImplicitCastExpr to be able to represent an XValue.
...
llvm-svn: 108807
2010-07-20 04:20:21 +00:00
Sebastian Redl
3d3f0b1039
Remove PCHReader::getStream(), it was unused. Inline PCHReader::getDelsCursor() into its sole caller and remove it. This reduces the attack surface of multiple PCH files towards code outside the PCH implementation.
...
llvm-svn: 108763
2010-07-19 22:38:35 +00:00
Sebastian Redl
bd1b5befee
Promote IdentifierOffsets to per-file data.
...
llvm-svn: 108762
2010-07-19 22:28:42 +00:00
Sebastian Redl
9e687994f3
Promote DeclOffsets and TypeOffsets to per-file data.
...
llvm-svn: 108760
2010-07-19 22:06:55 +00:00
Douglas Gregor
aa21cc401b
Introduce a new libclang API, clang_reparseTranslationUnit(), which
...
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.
llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Sebastian Redl
393f8b76c0
Promote the identifier table to per-file data. Also, if a CHAINED_METADATA record exists, it has to be the first thing in the PCH file.
...
llvm-svn: 108748
2010-07-19 20:52:06 +00:00
Daniel Dunbar
e38764c66c
Driver: Change the driver to take the path to the main executable, instead of
...
taking it in pieces.
- Fixes a problem where the Clang executable path was not initialized properly
on Win32, because sys::Path::getBasename() doesn't do what I always think it
does. Imagine that, a sys::Path interface that is confusing!
llvm-svn: 108667
2010-07-19 00:44:04 +00:00
Chris Lattner
ad4f38b1a9
BUILD_ARCHIVE is the default for libraries, no need to set it.
...
llvm-svn: 108633
2010-07-18 00:14:47 +00:00
Fariborz Jahanian
aea8e1e3d2
Added PCH/ASTImporter code for ObjCIvarDecl's field.
...
llvm-svn: 108627
2010-07-17 18:35:47 +00:00
Sebastian Redl
c2e6dbfa19
Teach the PCH reader to load the dependency when encountering a chain metadata record. WIP
...
llvm-svn: 108578
2010-07-17 00:12:06 +00:00
Sebastian Redl
2abc0383ce
Separate out the initial loading of a PCH so that loading chained PCHs can reuse it.
...
llvm-svn: 108551
2010-07-16 20:41:52 +00:00
Tom Care
826e6b4023
Improved false positive rate for the idempotent operations checker and moved it into the default path-sensitive analysis options.
...
- Added checks for static local variables, self assigned parameters, and truncating/extending self assignments
- Removed command line option (now default with --analyze)
- Updated test cases to pass with idempotent operation warnings
llvm-svn: 108550
2010-07-16 20:41:41 +00:00
Sebastian Redl
34522813e7
First baby steps towards PCHReader being able to keep track of multiple PCH files. WIP
...
llvm-svn: 108537
2010-07-16 17:50:48 +00:00
Sebastian Redl
1ea025bef9
Add a little more data to chained PCHs. WIP
...
llvm-svn: 108528
2010-07-16 16:36:56 +00:00
Daniel Dunbar
01ad0a78d0
Suppress !+Asserts warning.
...
llvm-svn: 108480
2010-07-16 00:00:11 +00:00
Sebastian Redl
85b2a6a430
Add a callback interface that allows interested parties to get notified whenever PCHReader deserializes a type or decl (and possibly other things in the future). Have PCHWriter implement these callbacks as noops and register to receive them if we're chaining PCHs. This will allow PCHWriter to track the IDs of these things, which it needs to write the dependent files. WIP
...
llvm-svn: 108383
2010-07-14 23:45:08 +00:00
Sebastian Redl
8b41f30064
There is another implementation of PCHReaderListener around. Update it to the new interface.
...
llvm-svn: 108377
2010-07-14 23:29:55 +00:00
Benjamin Kramer
8d5609b604
Pass StringRefs by value.
...
llvm-svn: 108375
2010-07-14 23:19:41 +00:00
Sebastian Redl
409183ff7c
Increase the max PCH level for declarations to 7. Add a FromPCH flag to types.
...
llvm-svn: 108354
2010-07-14 20:26:45 +00:00
Sebastian Redl
75fbb3b5e5
Make PCHReader cope with PCH files containing more than one predefines buffer.
...
llvm-svn: 108340
2010-07-14 17:49:11 +00:00
Douglas Gregor
f2753b3b4e
Downgrade the "when type is in parentheses, array cannot have dynamic
...
size" error for code like
new (int [size])
to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.
llvm-svn: 108242
2010-07-13 15:54:32 +00:00
Argyrios Kyrtzidis
36745fda34
Modify the pragma handlers to accept and use StringRefs instead of IdentifierInfos.
...
When loading the PCH, IdentifierInfos that are associated with pragmas cause declarations that use these identifiers to be deserialized (e.g. the "clang" pragma causes the "clang" namespace to be loaded).
We can avoid this if we just use StringRefs for the pragmas.
As a bonus, since we don't have to create and pass IdentifierInfos, the pragma interfaces get a bit more simplified.
llvm-svn: 108237
2010-07-13 09:07:17 +00:00
Douglas Gregor
11cfd9441d
Fix a documentation paste-o and eliminate a useless function parameter, both found by Sebastian
...
llvm-svn: 108214
2010-07-12 23:48:14 +00:00
Sebastian Redl
143413f8fb
Split the normal and chained PCH writing paths and add a tiny bit of implementation to the latter. WIP.
...
llvm-svn: 108200
2010-07-12 22:02:52 +00:00
Argyrios Kyrtzidis
f4cc7dcf9b
Simplify code using the new FoldingSetImpl::InsertNode() overload.
...
llvm-svn: 108198
2010-07-12 21:41:31 +00:00
Chandler Carruth
62e5e56dad
Switch to void-cast for this. Chris prefers that over the attribute, I'll
...
probably try and switch more of these if I can.
llvm-svn: 108085
2010-07-11 07:42:13 +00:00
Chandler Carruth
32652f3400
Mark assert-only variables as unused.
...
llvm-svn: 108068
2010-07-11 03:24:05 +00:00
Argyrios Kyrtzidis
b8d77eb300
Add PCH support for the remaining C++ exprs.
...
llvm-svn: 108042
2010-07-10 11:46:15 +00:00
Argyrios Kyrtzidis
8704057ce9
Reorganize how ClassTemplate[Partial]SpecializationDecls are read/written to avoid the
...
possibility of adding an unitialized one into the folding set.
llvm-svn: 108016
2010-07-09 21:11:43 +00:00
Argyrios Kyrtzidis
dd2061b2cd
isMemberSpecialization -> setMemberSpecialization.
...
llvm-svn: 108015
2010-07-09 21:11:35 +00:00
Sebastian Redl
4d3af3e192
When given the -chained-pch option and a previous PCH file, have the PCHWriter emit a CHAINED_METADATA record instead of METADATA, and write a link to the previous file there.
...
llvm-svn: 108014
2010-07-09 21:00:24 +00:00
Sebastian Redl
60876431b1
Correctly initialize Reader to null.
...
llvm-svn: 107994
2010-07-09 17:53:32 +00:00
Sebastian Redl
f525a30d19
Really respect -chained-pch.
...
llvm-svn: 107993
2010-07-09 17:40:12 +00:00
Douglas Gregor
8ed0c0b99d
Introduce -f{no-}spell-checking options to enable/disable
...
spell-checking. By default, spell-checking is enabled for Clang
(obviously) but disabled in CIndex for performance reasons.
llvm-svn: 107992
2010-07-09 17:35:33 +00:00
Sebastian Redl
f4b0c4b946
Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change.
...
llvm-svn: 107936
2010-07-09 00:00:58 +00:00
Sebastian Redl
595c51342c
Some preparatory work for chained PCH. No functionality change.
...
llvm-svn: 107915
2010-07-08 22:01:51 +00:00
Argyrios Kyrtzidis
7e8996c7e6
Introduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord when initializing.
...
ReadDeclRecord would hit assertion if the translation unit declaration was already loaded during
IdentifierInfo initialization.
llvm-svn: 107885
2010-07-08 17:13:02 +00:00
Argyrios Kyrtzidis
9f2d24a808
Support TemplateTemplateParmDecl for PCH.
...
llvm-svn: 107884
2010-07-08 17:12:57 +00:00
Argyrios Kyrtzidis
a4ed18191c
For TagType and TemplateSpecializationType, isDependent calculation may be invalid because some decls that the
...
calculation is using may still be initializing.
Thus, store the isDependent flag to PCH and restore directly to Type.
llvm-svn: 107873
2010-07-08 13:09:53 +00:00
Argyrios Kyrtzidis
1985bb3b10
Read/write the C++ parts of DeclRefExpr and MemberExpr for PCH.
...
llvm-svn: 107872
2010-07-08 13:09:47 +00:00
Argyrios Kyrtzidis
00dda6accc
Fix reading of UsingDecl from PCH.
...
llvm-svn: 107871
2010-07-08 13:09:41 +00:00
Douglas Gregor
747eb7840a
Reinstate the fix for PR7556. A silly use of isTrivial() was
...
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Douglas Gregor
e182370eda
Revert r107828 and r107827, the fix for PR7556, which seems to be
...
breaking bootstrap on Linux.
llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Douglas Gregor
6df2b8c3ac
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
...
newly-narrowed scope. No functionality change.
llvm-svn: 107828
2010-07-07 22:43:56 +00:00
Chris Lattner
3e2ee147d0
add driver support for minix, patch by Kees van Reeuwijk
...
from PR7583
llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Argyrios Kyrtzidis
ad65c6926b
Fix broken reading of NestedNameSpecifiers from PCH.
...
llvm-svn: 107784
2010-07-07 15:46:30 +00:00
Argyrios Kyrtzidis
903ccd6121
Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
...
declarations are fully initialized.
llvm-svn: 107783
2010-07-07 15:46:26 +00:00
Argyrios Kyrtzidis
46f556d4e5
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
...
llvm-svn: 107769
2010-07-07 11:31:23 +00:00
Tom Care
3ff08a8e76
Added a path-sensitive idempotent operation checker (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect.
...
Example:
{
int a = 1;
int b = 5;
int c = b / a; // a is 1 on all paths
}
- New IdempotentOperationChecker class
- Moved recursive Stmt functions in r107675 to IdempotentOperationChecker
- Minor refactoring of SVal to allow checking for any integer
- Added command line option for check
- Added basic test cases
llvm-svn: 107706
2010-07-06 21:43:29 +00:00
Duncan Sands
1614396b15
Pacify versions of gcc that think these variables may be used
...
uninitialized (which doesn't seem to be the case), by giving
them arbitrary initial values.
llvm-svn: 107679
2010-07-06 18:19:40 +00:00
Argyrios Kyrtzidis
39fdf81b43
Read/write function template specializations for PCH, properly this time.
...
llvm-svn: 107665
2010-07-06 15:37:09 +00:00
Argyrios Kyrtzidis
af2eac2869
Add to PCH missing Sema information about VTable uses and dynamic classes.
...
llvm-svn: 107664
2010-07-06 15:37:04 +00:00
Argyrios Kyrtzidis
181431cd91
Allow a CXXRecordDecl to get a DefinitionData pointer even when its owner is still initializing.
...
llvm-svn: 107663
2010-07-06 15:36:58 +00:00
Argyrios Kyrtzidis
282b36b7f6
Read/write instantiated-from-member of EnumDecl for PCH.
...
llvm-svn: 107662
2010-07-06 15:36:48 +00:00
Argyrios Kyrtzidis
a95d019150
Read/write the identifier namespace in PCH for decls that may modify it.
...
We can now use a PCH'ed <map>.
llvm-svn: 107617
2010-07-05 10:38:01 +00:00
Argyrios Kyrtzidis
927d8e06c1
Read/write some source location for PCH.
...
llvm-svn: 107616
2010-07-05 10:37:55 +00:00
Argyrios Kyrtzidis
b5fcdc21c2
Fix a regression of a previous commit of mine (rdar://8158953).
...
Some of the invariant checks for creating Record/Enum types don't hold true during PCH reading.
Introduce more suitable ASTContext::getRecordType() and getEnumType().
llvm-svn: 107598
2010-07-04 21:44:47 +00:00
Argyrios Kyrtzidis
6685e8a747
Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.
...
llvm-svn: 107597
2010-07-04 21:44:35 +00:00
Argyrios Kyrtzidis
e862cbc5f6
Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.
...
Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.
llvm-svn: 107595
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis
ccde6a02c8
Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
...
llvm-svn: 107594
2010-07-04 21:44:07 +00:00
Argyrios Kyrtzidis
cdb8b3f7ec
Read/write specialization info of static data members for PCH.
...
llvm-svn: 107593
2010-07-04 21:44:00 +00:00
Argyrios Kyrtzidis
dae2a1607e
When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
...
the invariant checks at NamespaceDecl::setAnonymousNamespace().
llvm-svn: 107566
2010-07-03 07:57:53 +00:00
Douglas Gregor
9672f92f7f
Lazily declare default constructors. We now delay the construction of
...
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:
4/159 implicit default constructors created
18/236 implicit copy constructors created
70/241 implicit copy assignment operators created
0/173 implicit destructors created
And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.
llvm-svn: 107551
2010-07-03 00:47:00 +00:00
Douglas Gregor
a6d695057c
Lazily declare implicit copy constructors.
...
llvm-svn: 107543
2010-07-02 23:41:54 +00:00
Argyrios Kyrtzidis
3701fcd759
Read/write CastExpr's CXXBaseSpecifierArray for PCH.
...
llvm-svn: 107542
2010-07-02 23:30:27 +00:00
Argyrios Kyrtzidis
4259ebcdac
Fix broken PCH support for CXXDefaultArgExpr.
...
llvm-svn: 107541
2010-07-02 23:30:15 +00:00
Douglas Gregor
330b9cff74
Lazily declare copy-assignment operators.
...
llvm-svn: 107521
2010-07-02 21:50:04 +00:00
Douglas Gregor
7454c563f1
Lazily declare the implicitly-declared destructor in a C++ class.
...
llvm-svn: 107510
2010-07-02 20:37:36 +00:00
Argyrios Kyrtzidis
335751610e
Handle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.
...
<vector> header can be used correctly through PCH now.
llvm-svn: 107483
2010-07-02 15:58:43 +00:00
Argyrios Kyrtzidis
373a83abdc
Fix reading FunctionDecls from PCH.
...
llvm-svn: 107477
2010-07-02 11:55:40 +00:00
Argyrios Kyrtzidis
e23371e71d
Fix reading ClassTemplateDecl's ClassTemplateSpecializationDecls and ClassTemplatePartialSpecializationDecls.
...
Store/read also their template arguments because they may be initializing and not be able to provide them.
llvm-svn: 107476
2010-07-02 11:55:37 +00:00
Argyrios Kyrtzidis
2c2167ac3d
Fully read/write CXXRecordDecl for PCH.
...
llvm-svn: 107475
2010-07-02 11:55:32 +00:00
Argyrios Kyrtzidis
e929095f4a
Fix reading of DependentNameType.
...
llvm-svn: 107474
2010-07-02 11:55:24 +00:00
Argyrios Kyrtzidis
dab33c5d33
Allow reading of InjectedClassNameType from PCH even when its decl is currently initializing.
...
llvm-svn: 107473
2010-07-02 11:55:20 +00:00
Argyrios Kyrtzidis
ee776bcb7a
Fix broken reading of member pointer from PCH.
...
llvm-svn: 107472
2010-07-02 11:55:15 +00:00
Argyrios Kyrtzidis
45a83f9acc
- Allow a typedef type to be read from PCH even if its decl is currently initializing.
...
- Fix creation of TemplateSpecializationType.
llvm-svn: 107471
2010-07-02 11:55:11 +00:00
Argyrios Kyrtzidis
e3029a7e7b
Fix broken reading of "#lines" from PCH.
...
llvm-svn: 107470
2010-07-02 11:55:05 +00:00
Argyrios Kyrtzidis
318b0e78c6
Generally types expect an initialized TypeDecl; its safer and less complicated to delay PCH reading the type of a TypeDecl.
...
llvm-svn: 107469
2010-07-02 11:55:01 +00:00
Argyrios Kyrtzidis
39f0e308c4
Add some side-effect free Create methods for TypeDecl subclasses and use them for PCH reading.
...
llvm-svn: 107468
2010-07-02 11:54:55 +00:00
Daniel Dunbar
bb7ac52e02
Driver/IRgen: Add support for -momit-leaf-frame-pointer.
...
llvm-svn: 107367
2010-07-01 01:31:45 +00:00
Argyrios Kyrtzidis
bd8ac8cf07
Fix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.
...
llvm-svn: 107268
2010-06-30 08:49:30 +00:00
Argyrios Kyrtzidis
4a57bd0d62
Support DependentSizedArrayType for PCH.
...
llvm-svn: 107267
2010-06-30 08:49:25 +00:00
Argyrios Kyrtzidis
f9f47c8e54
Support ParenListExpr for PCH.
...
llvm-svn: 107266
2010-06-30 08:49:18 +00:00
Daniel Dunbar
120a1e9d0f
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
...
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.
llvm-svn: 107255
2010-06-30 06:30:56 +00:00
Argyrios Kyrtzidis
74d28bd084
Support C++ friend declarations for PCH.
...
This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:
-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.
llvm-svn: 107219
2010-06-29 22:47:00 +00:00
Argyrios Kyrtzidis
26d7201d5d
When we know that we are at sub-statement reading (which is all of PCHStmtReader) use the "faster" ReadSubStmt. No functionality change.
...
llvm-svn: 107218
2010-06-29 22:46:25 +00:00
Argyrios Kyrtzidis
d0795b2d78
Modify the way sub-statements are stored and retrieved from PCH.
...
Before this commit, sub-stmts were stored as encountered and when they were placed in the Stmts stack we had to know what index
each stmt operand has. This complicated supporting variable sub-stmts and sub-stmts that were contained in TypeSourceInfos, e.g.
x = sizeof(int[1]);
would crash PCH.
Now, sub-stmts are stored in reverse order, from last to first, so that when reading them, in order to get the next sub-stmt we just
need to pop the last stmt from the stack. This greatly simplified the way stmts are written and read (just use PCHWriter::AddStmt and
PCHReader::ReadStmt accordingly) and allowed variable stmt operands and TypeSourceInfo exprs.
llvm-svn: 107087
2010-06-28 22:28:35 +00:00
Ted Kremenek
e60d304d13
Remove state assertion.
...
llvm-svn: 107064
2010-06-28 20:44:49 +00:00
Ted Kremenek
ea78375ed4
Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
...
llvm-svn: 107061
2010-06-28 20:32:40 +00:00
Argyrios Kyrtzidis
99a226dde4
Support CXXPseudoDestructorExpr for PCH.
...
llvm-svn: 106999
2010-06-28 09:32:03 +00:00
Argyrios Kyrtzidis
cd444d1af7
Support DependentScopeDeclRefExpr for PCH.
...
llvm-svn: 106998
2010-06-28 09:31:56 +00:00
Argyrios Kyrtzidis
b5288de67c
Refactor PCH reading/writing of template arguments passed to expressions.
...
llvm-svn: 106997
2010-06-28 09:31:48 +00:00
Argyrios Kyrtzidis
ddf5f211d0
Fix PCH emitting/reading for template arguments that contain expressions.
...
llvm-svn: 106996
2010-06-28 09:31:42 +00:00