Commit Graph

1598 Commits

Author SHA1 Message Date
Douglas Gregor 0e11955c7a Implement dependency analysis for the precompiled preamble. If any of
the files in the precompiled preamble have changed since it was build,
force the preamble to be rebuilt.

llvm-svn: 109937
2010-07-31 00:40:00 +00:00
Douglas Gregor 15ba0b34a9 Add some timers to ASTUnit that are only enabled when the LIBCLANG_TIMING environment variable is set.
llvm-svn: 109890
2010-07-30 20:58:08 +00:00
Sebastian Redl 3df5a08b99 Safely get a data pointer for vectors that might be empty.
llvm-svn: 109867
2010-07-30 17:03:48 +00:00
Argyrios Kyrtzidis b24355af87 Refactor the way PCHReader tracks whether we are in recursive loading.
-Replace CurrentlyLoadingTypeOrDecl with a counting scheme (NumCurrentElementsDeserializing)
-Provide outside access to the mechanism by adding methods StartedDeserializing/FinishedDeserializing
  to ExternalASTSource.

These are preparation for the next commit.

llvm-svn: 109856
2010-07-30 10:03:16 +00:00
Sebastian Redl 07a89a83d4 Make macro weirdness in chained PCH work. This required changing the way PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now.
llvm-svn: 109823
2010-07-30 00:29:29 +00:00
Argyrios Kyrtzidis c904933aac Change the name to something less terrible; suggestion by Doug. No functionality change.
llvm-svn: 109797
2010-07-29 20:08:05 +00:00
Argyrios Kyrtzidis d67d4cc82f Implement PCH support for offsetof(base-specifier).
llvm-svn: 109785
2010-07-29 18:16:10 +00:00
Argyrios Kyrtzidis c81af03fb3 Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.

This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl
needs to be deserialized during PCH loading for codegen purposes.
Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext,
thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen.

This fixes current (and avoids future) codegen-from-PCH bugs.

llvm-svn: 109784
2010-07-29 18:15:58 +00:00
Peter Collingbourne 2bf3d24ca1 Store latest redeclaration for each redeclarable template declaration
This patch adds a Latest field to RedeclarableTemplateDecl's CommonBase
class which is used to store the latest redeclaration.

llvm-svn: 109755
2010-07-29 16:12:01 +00:00
Peter Collingbourne 91b25b7419 Refactor redeclarable template declarations
This patch refactors much of the common code in ClassTemplateDecl and
FunctionTemplateDecl into a common base class RedeclarableTemplateDecl
together with support functions in a template class RedeclarableTemplate.

The patch also includes similar refactoring for these classes' PCH
reader and writer implementations.

llvm-svn: 109754
2010-07-29 16:11:51 +00:00
Douglas Gregor a5fd522992 Turn off precompiled preamble support for C++
llvm-svn: 109680
2010-07-28 22:12:37 +00:00
Sebastian Redl 04f5c31e98 Support extended vector types in chained PCH.
llvm-svn: 109675
2010-07-28 21:38:49 +00:00
Sebastian Redl 9891212476 Record macros in dependent PCHs. Also add various info tables to dependent PCHs; tests for this to follow.
llvm-svn: 109554
2010-07-27 23:01:28 +00:00
Argyrios Kyrtzidis c0279a9826 Revert r109546, it broke linux build.
llvm-svn: 109550
2010-07-27 22:37:14 +00:00
Argyrios Kyrtzidis 4fac280618 Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.

This function is part of the public CodeGen interface since it's essentially a CodeGen predicate that is also
needed by the PCH mechanism to determine whether a decl needs to be deserialized during PCH loading for codegen purposes.
This fixes current (and avoids future) codegen-from-PCH bugs.

llvm-svn: 109546
2010-07-27 22:01:17 +00:00
Sebastian Redl 4b1f490860 Update the list of lexical decls in the TU for chained PCHs. This makes -ast-print show the decls from the dependent PCH.
llvm-svn: 109524
2010-07-27 18:24:41 +00:00
Douglas Gregor 96c042616e Fix use-after-free with precompiled preambles
llvm-svn: 109505
2010-07-27 14:52:07 +00:00
Argyrios Kyrtzidis 76314d1ea8 Always deserialize from PCH file scoped variables with non trivial constructor/destructor.
Fixes http://llvm.org/PR7692

llvm-svn: 109501
2010-07-27 12:56:10 +00:00
Ted Kremenek fee882ac95 PTH generation: Don't save the leading '#' token in a null directive. This unbreaks using PTH with Boost (<rdar://problem/8227989>).
llvm-svn: 109484
2010-07-27 02:58:57 +00:00
Douglas Gregor ce3a8293a0 Implement -fno-validate-pch at the -cc1 level, which suppresses most
of the usual consistency checks used to determine when a precompiled
header is incompatible with the translation unit it's being loaded
into.

Enable this option when loading a precompiled preamble, because the
preamble loader will be performing all of this checking itself. Enable
the preamble-based test now that it's working.

This option is also useful for debugging Clang's PCH
(<rdar://problem/7532213>).

llvm-svn: 109475
2010-07-27 00:27:13 +00:00
Sebastian Redl 66c5eef182 - Fix recording of offsets of types in dependent PCHs.
- Stop reading in (and thus deserializing) every declaration in the TU when creating a dependent PCH.
- Switch the storage of a decl context's lexical declarations to a blob containing the IDs instead of a record. This is the only sane way of supporting update records later on.

llvm-svn: 109474
2010-07-27 00:17:23 +00:00
Douglas Gregor 3f4bea0646 Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.

llvm-svn: 109445
2010-07-26 21:36:20 +00:00
Dan Gohman 0eb9c124a7 It's not necessary to call flush() on a raw_ostream immediately prior
to deleting it.

llvm-svn: 109441
2010-07-26 21:29:50 +00:00
Nick Lewycky 19b9f958e1 Add source location information to C++ base specifiers.
llvm-svn: 109396
2010-07-26 16:56:01 +00:00
Douglas Gregor 67ca40c419 Eliminate the "minimal" and printing parser actions, which only ever
worked for C anyway. Also kills the -cc1 options -parse-noop and
-parse-print-callbacks.

llvm-svn: 109392
2010-07-26 04:08:02 +00:00
Douglas Gregor 5b11d49a7c Make ASTContext always use the BumpPtrAllocator.
llvm-svn: 109375
2010-07-25 17:53:33 +00:00
Nick Lewycky e602efc6f6 Remove emacs file mode marker on file with .cpp extension.
llvm-svn: 109366
2010-07-25 03:12:58 +00:00
Nick Lewycky 84a11fdf57 Add header searching for llvm-gcc trunk on Gentoo AMD64. Patch by Mark Wood!
llvm-svn: 109357
2010-07-24 21:33:13 +00:00
Douglas Gregor f5275a8339 Put a newline at the end of the padded buffers used for the
precompiled preamble. This will suppress the -pedantic "no newline at
end of file" warning.

llvm-svn: 109301
2010-07-24 00:42:07 +00:00
Douglas Gregor 6481ef1f9c Once we've built (or reused) a precompiled preamble, create the
appropriately-padded main file buffer (that has spaces in the extra
"reserved" space) and thread that buffer through to the parsing
function. This still does nothing.

llvm-svn: 109299
2010-07-24 00:38:13 +00:00
Douglas Gregor 4dde74988e Once we've built a precompiled preamble, keep track of the details of
that preamble (the preamble text, preamble file, reserved main file
size). Check these details when we try to rebuild the precompiled
preamble, and when nothing has changed, re-use the precompiled
preamble.

This code is still very much a WIP, and can't even properly be tested
because we have no way to use the precompiled preamble yet. "Trust me"

llvm-svn: 109294
2010-07-23 23:58:40 +00:00
Sebastian Redl ff4a2951d9 Make declarations in the dependent PCH visible, for C at least.
llvm-svn: 109292
2010-07-23 23:49:55 +00:00
Fariborz Jahanian c51609a0b5 PCH read/write for selector reference pool.
Finishes off radar 6507158.

llvm-svn: 109256
2010-07-23 19:11:11 +00:00
Zhongxing Xu 318e40360d Fix build on Ubuntu 10.04.
llvm-svn: 109208
2010-07-23 02:15:08 +00:00
Douglas Gregor be2d8c6096 Basic plumbing for generating a precompiled preamble for an
ASTUnit/CXTranslationUnit. We can't actually use this preamble yet,
however.

llvm-svn: 109202
2010-07-23 00:33:23 +00:00
Sebastian Redl c67764eb4b Thread bitstream cursors all the way through the AST reading stuff. This way, reading a trivial 2-element chained file actually works.
llvm-svn: 109191
2010-07-22 22:43:28 +00:00
Fariborz Jahanian 6e7e8cc19d atch for implementation of objective-c's -Wselector
warning flag in clang. Little more to do
for a PCH issue. Radar 6507158.

llvm-svn: 109129
2010-07-22 18:24:20 +00:00
Argyrios Kyrtzidis 2d8891cd5d Read/write C++0x static_assert for PCH.
llvm-svn: 109123
2010-07-22 17:28:12 +00:00
Sebastian Redl 5c415f3e32 Allow loading declcontext information from any file in the chain. Properly write source locations to dependent files. WIP
llvm-svn: 109119
2010-07-22 17:01:13 +00:00
Argyrios Kyrtzidis 165b58181f Read/write FriendTemplateDecl for PCH.
llvm-svn: 109113
2010-07-22 16:04:10 +00:00
Argyrios Kyrtzidis 47cd7a91f4 Support C++ try/catch statements for PCH.
llvm-svn: 109112
2010-07-22 16:03:56 +00:00
Sebastian Redl 4e6c567653 Allow loading macros from any file in the chain. WIP
llvm-svn: 109048
2010-07-21 22:31:37 +00:00
Sebastian Redl fa0614458a Promote some macro-related stuff to per-file data. Fix a cache-inefficient nested loop by inverting the nesting. Store the size of each file in the chain; will need this later for statement offsets.
llvm-svn: 109030
2010-07-21 20:07:32 +00:00
Sebastian Redl c713b9665b Allow loading identifiers from any file in the chain. WIP
llvm-svn: 108974
2010-07-21 00:46:22 +00:00
Sebastian Redl b2831dbff7 Apparently not every system thinks that references in pairs are as cool as I think.
llvm-svn: 108959
2010-07-20 22:55:31 +00:00
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
Argyrios Kyrtzidis 0b0369a6b3 Fix various bugs in recent commits for C++ PCH.
llvm-svn: 106995
2010-06-28 09:31:34 +00:00
Chris Lattner 51924e517b Implement support for -fwrapv, rdar://7221421
As part of this, pull together trapv handling into the same enum.

This also add support for NSW multiplies.

This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get 
defined etc).

llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner 30c924b3e8 Implement support for #pragma message, patch by Michael Spencer!
llvm-svn: 106950
2010-06-26 17:11:39 +00:00
Argyrios Kyrtzidis b1d38e3f4a Support NonTypeTemplateParmDecl for PCH.
llvm-svn: 106860
2010-06-25 16:25:09 +00:00
Argyrios Kyrtzidis 03e5e0467c Make PCHWriter::FlushStmts() robust. If we added null Stmts, reading them back got messed up.
llvm-svn: 106859
2010-06-25 16:25:02 +00:00
Argyrios Kyrtzidis f0f7a792d7 Support DependentTemplateSpecializationType and ElaboratedType for PCH.
llvm-svn: 106858
2010-06-25 16:24:58 +00:00
Argyrios Kyrtzidis dc9ca0afa8 Add forgotten breaks in case statements.
llvm-svn: 106857
2010-06-25 16:24:51 +00:00
Argyrios Kyrtzidis 58e01ad26f Support UnresolvedLookupExpr for PCH.
llvm-svn: 106832
2010-06-25 09:03:34 +00:00
Argyrios Kyrtzidis b8d3c63820 Support UnresolvedMemberExpr for PCH.
llvm-svn: 106831
2010-06-25 09:03:26 +00:00
Argyrios Kyrtzidis 6ba1bb5dec Print source location when we encounter unhandled statement during PCH writing.
llvm-svn: 106830
2010-06-25 09:03:12 +00:00
Eric Christopher ca10da8839 Remove HAS_TLS define.
llvm-svn: 106786
2010-06-24 20:41:41 +00:00
Argyrios Kyrtzidis bfcacee9b3 Support a couple more C++ Exprs for PCH.
llvm-svn: 106727
2010-06-24 08:57:31 +00:00
Argyrios Kyrtzidis 30d98f3d9e Fix broken de/serialization for a couple of C++ Exprs.
llvm-svn: 106726
2010-06-24 08:57:09 +00:00
Eric Christopher 03256c32ff More clang support for darwin tls. Add a __has_feature macro and
target specific preprocessor define as well.

llvm-svn: 106715
2010-06-24 02:02:00 +00:00
Argyrios Kyrtzidis 818c5db054 Support C++ class template specializations and partial specializations for PCH.
llvm-svn: 106625
2010-06-23 13:48:30 +00:00
Chris Lattner 37141f4fb4 improve altivec vector bool/pixel support, patch by Anton Yartsev
with several tweaks by me.

llvm-svn: 106619
2010-06-23 06:00:24 +00:00
Fariborz Jahanian 3bf0ded346 Patch to provide separate ASTs for multiple ObjC class extension
declarations (implements radar 7928731).

llvm-svn: 106597
2010-06-22 23:20:40 +00:00
Argyrios Kyrtzidis 6e57c35513 Read/write CXXDeleteExpr from/to PCH.
llvm-svn: 106552
2010-06-22 17:07:59 +00:00
Argyrios Kyrtzidis 69da4a8f07 Support emitting/reading function templates to/from PCH.
llvm-svn: 106534
2010-06-22 09:55:07 +00:00
Argyrios Kyrtzidis ae85e2414c -Introduce PCHReader::ReadTemplateArgumentLoc()
-Introduce PCHWriter::AddTemplateArgumentLocInfo()
-Modify PCHWriter::AddTemplateArgumentLoc() to also write TemplateArgumentLoc's TemplateArgument
  and move the existing calls of AddTemplateArgumentLoc() to AddTemplateArgumentLocInfo().

llvm-svn: 106533
2010-06-22 09:54:59 +00:00
Chris Lattner 3c77a355e0 implement support for -finstrument-functions, patch by Nelson
Elhage!

llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Douglas Gregor 27b98eae80 Alter the internal representation of the condition variable in
if/while/switch/for statements to ensure that walking the children of
these statements actually works. Previously, we stored the condition
variable as a VarDecl. However, StmtIterator isn't able to walk from a
VarDecl to a set of statements, and would (in some circumstances) walk
beyond the end of the list of statements, cause Bad Behavior.

In this change, we've gone back to representing the condition
variables as DeclStmts. While not as memory-efficient as VarDecls, it
greatly simplifies iteration over the children. 

Fixes the remainder of <rdar://problem/8104754>.

llvm-svn: 106504
2010-06-21 23:44:13 +00:00
Tom Care 3f272b853f Bug 7377: printf checking fails to flag some undefined behavior
http://llvm.org/bugs/show_bug.cgi?id=7377

Updated format string highlighting and fixits to take advantage of the new CharSourceRange class.
- Change HighlightRange to allow highlighting whitespace only in a CharSourceRange (for warnings about the ' ' (space) flag)
- Change format specifier range helper function to allow for half-open ranges (+1 to end)
- Enabled previously failing tests (FIXMEs/XFAILs removed)
- Small fixes and additions to format string test cases

M       test/Sema/format-strings.c
M       test/Sema/format-strings-fixit.c
M       lib/Frontend/TextDiagnosticPrinter.cpp
M       lib/Sema/SemaChecking.cpp

llvm-svn: 106480
2010-06-21 21:21:01 +00:00
Argyrios Kyrtzidis a35c8e4092 Combine ClassTemplateDecl's PreviousDeclaration with CommonPtr, as in FunctionTemplateDecl.
llvm-svn: 106412
2010-06-21 10:57:41 +00:00
Argyrios Kyrtzidis 41d4562da2 Support PCH emitting/reading of using declarations.
llvm-svn: 106404
2010-06-20 14:40:59 +00:00
Argyrios Kyrtzidis 26b72453f7 Include a hack to allow loading of templated CXXRecordDecls and test template reading from PCH.
llvm-svn: 106393
2010-06-19 19:29:21 +00:00
Argyrios Kyrtzidis 95c04caf92 Initial support for reading templates from PCH.
llvm-svn: 106392
2010-06-19 19:29:09 +00:00
Argyrios Kyrtzidis 106caf92cd Initial support for writing templates to PCH.
llvm-svn: 106391
2010-06-19 19:28:53 +00:00
Chris Lattner ed8b6b799d introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange.  CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token.  While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff.  To start taking advantage of
the new capabilities, you can do something like this:
  Diag(..) << CharSourceRange::getCharRange(Begin,End)

llvm-svn: 106338
2010-06-18 22:45:06 +00:00
Douglas Gregor ebada077d9 Given Decl::isUsed() a flag indicating when to consider the "used"
attribute as part of the calculation. Sema::MarkDeclReferenced(), and
a few other places, want only to consider the "used" bit to determine,
e.g, whether to perform template instantiation. Fixes a linkage issue
with Boost.Serialization.

llvm-svn: 106252
2010-06-17 23:14:26 +00:00
Alexis Hunt c675ec09f0 Update CMake build for new attribute changes.
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Alexis Hunt 344393e9cf Implement first TD-based usage of attributes.
Currently, there are two effective changes:

 - Attr::Kind has been changed to attr::Kind, in a separate namespace
   rather than the Attr class. This is because the enumerator needs to
   be visible to parse.
 - The class definitions for the C++0x attributes other than aligned are
   generated by TableGen.

The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.

llvm-svn: 106172
2010-06-16 23:43:53 +00:00
Daniel Dunbar 7c995e8fac Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!
llvm-svn: 106113
2010-06-16 16:59:23 +00:00
Douglas Gregor f56055aee3 Add Cygwin C++ header search path.
llvm-svn: 106108
2010-06-16 16:24:51 +00:00
Chris Lattner bba37f4dea fix the various buildbot failures by ensuring that tokens are really completely initialized.
llvm-svn: 106043
2010-06-15 21:06:38 +00:00
Chris Lattner 4e18a2bc97 fix an uninitialized variable, patch by Michael Spencer!
llvm-svn: 106025
2010-06-15 18:55:23 +00:00
Daniel Dunbar c1b1729b66 Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen.  This is suboptimal for
clients which only wish to make use of the frontend.  CodeGen in
particular introduces a large number of unwanted dependencies.

This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries.  The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).

After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").

N.B. This patch includes file renames which are indicated in the
patch body.

Changes in this revision of the patch:
 - Fixed some copy-paste mistakes in the header files
 - Modified certain aspects of the coding to comply with the LLVM
   Coding Standards

llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Douglas Gregor 0832963acd Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Ted Kremenek 4c721bf892 Change AnalysisConsumer to analyze functions created by instantiantiating a macro. Fixes PR 7361.
llvm-svn: 105984
2010-06-15 00:55:40 +00:00
Chris Lattner c7ed7ea390 fix the inline asm diagnostics to emit the error on the primary
source code location instead of on the note.  Previously we generated:

<inline asm>:1:2: error: unrecognized instruction
        barf
        ^
t.c:4:8: note: generated from here
  asm ("barf");
       ^

Now we generate:

t.c:4:8: error: unrecognized instruction
  asm ("barf");
       ^
<inline asm>:1:2: note: instantated into assembly here
        barf
        ^

llvm-svn: 105978
2010-06-15 00:03:12 +00:00
Chris Lattner bc6bcabc61 fix PR7360: -P mode turns off line markers, but not blank space.
Apparently some programs which abuse the preprocessor depend 
on this.

llvm-svn: 105889
2010-06-12 16:20:56 +00:00
Argyrios Kyrtzidis 9116717189 Fix PCH issue. Attributes of a declaration were truncated to just one when the decl was read from a PCH file.
llvm-svn: 105852
2010-06-11 23:09:25 +00:00
Daniel Dunbar a442fd5da6 Driver: Fix arg_iterator typing to reflect that it is really an iterator over Arg*s.
llvm-svn: 105838
2010-06-11 22:00:13 +00:00
Daniel Dunbar d839e77b12 Preprocessor: Ignore unknown pragmas in -E -dM and -Eonly modes.
llvm-svn: 105830
2010-06-11 20:10:12 +00:00
Jeffrey Yasskin 2b99c6fc4f Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed.  We default to 'all'.  At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.

llvm-svn: 105815
2010-06-11 05:57:47 +00:00
Charles Davis 95a546ee4d Add an option to specify the target C++ ABI to the frontend. Use it to
select either the default Itanium ABI or the new, experimental Microsoft ABI.

llvm-svn: 105804
2010-06-11 01:06:47 +00:00
John McCall c392f37ae8 Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'.  The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.

llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Chandler Carruth c65667c8ba Another chunk of the new RecursiveASTVisitor implementation: switch the return
value semantics such that we recurse while the visitors return true, and halt
as soon as one returns false. Patch by csilvers.

llvm-svn: 105787
2010-06-10 10:31:57 +00:00
Daniel Dunbar 0bcb62dc30 Frontend: Fix crashes on error paths.
llvm-svn: 105759
2010-06-09 22:30:54 +00:00
Chandler Carruth af80f66997 Major redesign of the RecursiveASTVisitor. This implements the majority of the
new design discussed on cfe-dev, with further steps in that direction to come.
It is already much more complete than the previous visitor.

Patch by Zhanyong and Craig with 80 column wraps and one missing declaration
added by me.

llvm-svn: 105709
2010-06-09 08:17:30 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Daniel Dunbar 6f8362c6bf Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality.

For example, 'llvm-as' is:
  $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc
and 'llvm-dis' is:
  $ clang -cc1 -emit-llvm    FOO.bc -o -
and 'opt' is, e.g.:
  $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll
and 'llc' is, e.g.:
  $ clang -cc1 -S -o - FOO.ll

The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options).

llvm-svn: 105583
2010-06-07 23:27:59 +00:00
Daniel Dunbar 9507f9cc05 Frontend: Add FrontendAction support for handling LLVM IR inputs.
- These inputs follow an abbreviated execution path, but are still worth handling by FrontendAction so they reuse all the other clang -cc1 features.

llvm-svn: 105582
2010-06-07 23:26:47 +00:00
Daniel Dunbar fcb2e6ddea FrontendAction: Track active file kind.
llvm-svn: 105581
2010-06-07 23:25:49 +00:00