Ted Kremenek [Wed, 5 Dec 2007 21:36:08 +0000 (21:36 +0000)]
Added "TranslationUnit" class that will be used to provide an interface
for serializing/deserializing ASTs that is decoupled from the logic
in SerializationTest (which will soon be rewritten to use this interface).
Ted Kremenek [Wed, 5 Dec 2007 21:34:36 +0000 (21:34 +0000)]
Modified: CreateTargetInfo(). Now takes Diagnostic* instead of Diagnostic&.
Modified: ctor of SerializationTest: Now takes LangOptions argument. We
will eventually serialize this as well.
Ted Kremenek [Wed, 5 Dec 2007 18:27:04 +0000 (18:27 +0000)]
Moved creation of ASTConsumers that can operate on both freshly-parsed and
deserialized ASTs into the function CreateASTConsumer(). This function
is called by ProcessInputFile, and soon the logic that processes deserialized
ASTs.
Anders Carlsson [Wed, 5 Dec 2007 04:57:06 +0000 (04:57 +0000)]
Revert DidWarn change - It won't catch all cases anyway and GCC warns for every excess element. Maybe later we can add back the limit and make it smarter.
Ted Kremenek [Wed, 5 Dec 2007 00:19:51 +0000 (00:19 +0000)]
Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with
the deserializer.
Ted Kremenek [Tue, 4 Dec 2007 17:07:35 +0000 (17:07 +0000)]
Removed searching for "darwin" keyword in target triple. We don't really support
any alternative targets at this point other than "darwin," so we now default to
Darwin targets (for now).
Ted Kremenek [Tue, 4 Dec 2007 16:54:09 +0000 (16:54 +0000)]
Removed IntrusiveSPtr. There are no clients of this class anymore, so it is
not needed, and it was never extensively tested. If we need an intrusive
reference-counting smart pointer, we can always import intrusive_ptr from
boost.
Ted Kremenek [Mon, 3 Dec 2007 22:06:55 +0000 (22:06 +0000)]
Implemented initial support for "-triple" option to the clang driver. This
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).
The new behavior is as follows:
(1) If the user does not specify -triple:
(a) If no -arch options are specified, the target triple used is the host
triple (in llvm/Config/config.h).
(b) If one or more -arch's are specified (and no -triple), then there is
one triple for each -arch, where the specified arch is substituted
for the arch in the host triple. Example:
host triple = i686-apple-darwin9
command: clang -arch ppc -arch ppc64 ...
triples used: ppc-apple-darwin9 ppc64-apple-darwin9
(2) The user does specify a -triple (only one allowed):
(a) If no -arch options are specified, the triple specified by -triple
is used. E.g clang -triple i686-apple-darwin9
(b) If one or more -arch options are specified, then the triple specified
by -triple is used as the primary target, and the arch's specified
by -arch are used to create secondary targets. For example:
has the following targets:
i686-apple-darwin9 (primary target)
ppc-apple-darwin9
ppc64-apple-darwin9
Other changes related to the changes to the driver:
- TargetInfoImpl now includes the triple string.
- TargetInfo::getTargetTriple returns the triple for its primary target.
- test case test/Parser/portability.c has been updated because "-arch linux" is
no longer valid ("linux" is an OS, not an arch); instead we use a bogus
architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.
Ted Kremenek [Mon, 3 Dec 2007 17:09:21 +0000 (17:09 +0000)]
Added getTrueExpr() and getFalseExpr() to ConditionalOperator. These methods
provide handy accessors to the subexpressions of ConditionalOperator that
automatically take into account the GCC extension where the "LHS" expression is
omitted: e.g x ?: y;. When the LHS expression is available, getTrueExpr() is the
same as getLHS(); when LHS is NULL, getTrueExpr() returns the condition expression.
Bill Wendling [Mon, 3 Dec 2007 07:33:35 +0000 (07:33 +0000)]
Fix for testcase that assigns a dereferenced reference to a pointer. The
standard says that we should adjust the "reference to T" type to "T"
before analysis.
Chris Lattner [Sun, 2 Dec 2007 07:09:19 +0000 (07:09 +0000)]
Handle global variable definitions which change the type of a definition, such as:
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }
Oliver Hunt [Sun, 2 Dec 2007 00:11:25 +0000 (00:11 +0000)]
Support initalisers for more than just int-typed static variables.
We now use the CodeGenModule logic for generating the constant
initialiser expression, so happily further initialiser fixes should
automatically work for statics as well.
When generating the CodeGen type name of a struct, union, enum use the typedef
name if a tag type name is not available for the type. This matches how llvm-gcc
chooses CodeGen type names.
This means that "typedef struct {...} foo" now results in a CodeGen name of
"struct.foo" rather than "struct."
Ted Kremenek [Sat, 1 Dec 2007 04:43:17 +0000 (04:43 +0000)]
Fixed bug in the serialization of SelectorTable where we did not register the
pointer of MultiKeywordSelectors.
Added optimization to the serialization of SelectorTable where we only serialize
out MultiKeywordSelectors that are ever referenced by an object other than the
SelectorTable.
Chris Lattner [Fri, 30 Nov 2007 22:53:43 +0000 (22:53 +0000)]
start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't. This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.
Steve Naroff [Thu, 29 Nov 2007 23:05:20 +0000 (23:05 +0000)]
Yesterday, I simplified how we stream top-level decls.
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).
TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...
Ted Kremenek [Thu, 29 Nov 2007 23:05:17 +0000 (23:05 +0000)]
Added method "HandleTopLevelDeclaration" to ASTConsumer. This will eventually
be the new hook that ASTStreamer calls to feed top-level Decls to
ASTConsumers.
The difference between "HandleTopLevelDeclaration" and "HandleTopLevelDecl" is
that "HandleTopLevelDecl" is currently called by ASTStreamer for every
top-level declaration, including those that appear within a Decl chain. Using
the new interface, ASTStreamer would only call HandleTopLevelDeclaration for
Decls that appear that the beginning of a Decl chain (i.e., a group of related
decls).
To preserve the behavior that all subclasses of ASTConsumer currently expect,
the default implementation of HandleTopLevelDeclaration simply calls
HandleTopLevelDecl, and for decl chains it calls HandleTopLevelDecl for each
Decl* in a chain of Decls.
The advantage of this interface is that some subclasses of ASTConsumer only
really want the Decl chain, and not each individual Decl passed to them. This
extra level of indirection allows subclasses to override the default behavior
if they so desire.