Ted Kremenek [Mon, 19 Oct 2009 21:44:57 +0000 (21:44 +0000)]
The constructor for ASTUnit now takes a DiagnosticClient*, allowing uses of ASTUnit to specify
alternate DiagnosticClients. To match this API, ASTUnit::LoadFromPCHFile() now takes a corresponding
DiagnosticClient* argument as well. The DiagnosticClient object is destroyed when the ASTUnit object
is destroyed.
The CIndex library now uses this API to create a 'IgnoreDiagnosticsClient' that simply silences
diagnostics when using the clang_createTranslationUnitFromSourceFile() function. This fixes
<rdar://problem/7312058>. This API can change in the future as we add more flexibility for clients.
Ted Kremenek [Mon, 19 Oct 2009 21:17:25 +0000 (21:17 +0000)]
Re-order includes so that the logic involving '#ifdef LLVM_ON_WIN32' appears after the main #includes. The ultimate solution is to just use LLVM-portable methods in llvm/System.
Steve Naroff [Mon, 19 Oct 2009 14:34:22 +0000 (14:34 +0000)]
Move Diagnostic/DiagClient/FileManager from Indexer => ASTUnit.
Removing this shared data should enable clang_createTranslationUnit/clang_createTranslationUnitFromSourceFile to be run from multiple threads (related to <rdar://problem/7303432>).
Daniel Dunbar [Mon, 19 Oct 2009 09:11:21 +0000 (09:11 +0000)]
Workaround a bug exposed by the FileCheckify of message-length.c, the caret end
column computation isn't correct and could exceed the line length, which
resulted in a buffer overflow later.
- Chris, is there a better way for this code to compute the final column used
by the caret?
Daniel Dunbar [Mon, 19 Oct 2009 01:21:12 +0000 (01:21 +0000)]
Update NamedDecl::getName() to work for empty names.
- I'm not sure this is ideal, but otherwise clients must be overly careful when handling decl's which can have empty names.
Anders Carlsson [Sun, 18 Oct 2009 23:09:21 +0000 (23:09 +0000)]
When binding a reference to a temporary, it's important that other temporaries created as on the RHS are destroyed before emitting the dtor for the temporary.
Nate Begeman [Sun, 18 Oct 2009 20:10:40 +0000 (20:10 +0000)]
Support IRgen of OpenCL vector initializers, ensuring the resulting IR is in a
form that LLVM code generators can turn into efficient code. For example,
int4 a, b, c;
a = (int4)(b.yzw, a.x)
The AuroraUX toolchain has conflicting wchar_t between the system stdlib.h header and the clang stddef.h header where clang was defining as int where we use long.
John McCall [Sun, 18 Oct 2009 09:09:24 +0000 (09:09 +0000)]
When performing template-substitution into a type, don't just replace the
TemplateTypeParmType with the substituted type directly; instead, replace it
with a SubstTemplateTypeParmType which will note that the type was originally
written as a template type parameter. This makes it reasonable to preserve
source information even through template substitution.
Also define the new SubstTemplateTypeParmType class, obviously.
For consistency with current behavior, we stringize these types as if they
were the underlying type. I'm not sure this is the right thing to do.
At any rate, I paled at adding yet another clause to the don't-desugar 'if'
statement, so I extracted a function to do it. The new function also does
The Right Thing more often, I think: e.g. if we have a chain of typedefs
leading to a vector type, we will now desugar all but the last one.
Daniel Dunbar [Sun, 18 Oct 2009 02:09:17 +0000 (02:09 +0000)]
Simplify HandleFormatAttr.
- I have this crazy dream that one day someone will invent a miraculous tool so
that developers, instead of hand optimizing their source code to obscure its
intent and decrease its maleability, will instead write what they mean, and
this strange and wonderful tool -- which I imagine would be called something
fancy sounding like "an optimizing compiler" -- will make their code fast
*for* them. With all the saved time, developers could maybe even focus on
making the magic "optimizing compiler" better!!
- No intended functionality change, all though I expect the universe to mock me
for snarkiness.
John McCall [Sun, 18 Oct 2009 01:05:36 +0000 (01:05 +0000)]
Clone the full Type hierarchy into the TypeLoc hierarchy. Normalize
TypeLoc class names to be $(Type classname)Loc. Rewrite the visitor.
Provide skeleton implementations for all the new TypeLocs.
Handle all cases in PCH. Handle a few more cases when inserting
location information in SemaType.
It should be extremely straightforward to add new location information
to existing TypeLoc objects now.
Douglas Gregor [Sat, 17 Oct 2009 21:40:42 +0000 (21:40 +0000)]
When type-checking a C++ "new" expression, don't type-check the actual
initialization if any of the constructor/initialization arguments are
type-dependent. Fixes PR5224.
Sebastian Redl [Sat, 17 Oct 2009 21:12:09 +0000 (21:12 +0000)]
When resolving the address of an overloaded function or function template, mark the result as referenced.
The most important effect of this is that function templates only referenced by address expressions now get instantiated. This, in turn, means that Hello World compiles with the Apache stdcxx library even when using endl.
Sebastian Redl [Sat, 17 Oct 2009 20:50:27 +0000 (20:50 +0000)]
Don't add implicit casts of explicit address-taking of overloaded functions.
Taking the address of an overloaded function with an explicit address-of operator wrapped the operator in an implicit cast that added yet another pointer level, leaving us with a corrupted AST, which crashed CodeGen in the test case I've added. Fix this by making FixOverloadedFunctionReference return whether there was an address-of operator and not adding the implicit cast in that case.
Sebastian Redl [Sat, 17 Oct 2009 19:37:06 +0000 (19:37 +0000)]
In some dependent contexts, incomplete array types persist into FinalizeDeclaratorGroup. Don't require them to have a complete type. This allows us to compile Hello World with the Apache stdcxx library. If you don't use endl, it even links and runs.
Daniel Dunbar [Sat, 17 Oct 2009 09:38:57 +0000 (09:38 +0000)]
Remove a FIXME that doesn't belong, there are numerous other places that use
alignment in bits in clang. If we really want to fix this, it should be a bugzilla.
Zhongxing Xu [Sat, 17 Oct 2009 08:39:24 +0000 (08:39 +0000)]
Per discussion with Ted, the 'FromSuper'/'FromSub' logic is invalid. Simplify
the code to standard worklist algorithm. Always add both sub and super
regions of live regions.
Daniel Dunbar [Sat, 17 Oct 2009 06:13:04 +0000 (06:13 +0000)]
Don't crash when dumping pretty stack traces, if the current tok is an
annotation token.
- I'm not sure what the best thing to print is, for now we just print the token
location and 'at annotation token'.
Daniel Dunbar [Sat, 17 Oct 2009 03:28:48 +0000 (03:28 +0000)]
Add IdentiferInfo::getNameStr() -> StringRef.
Also, add getNameStart as a synonym for getName(). getName() is now deprecated,
when all clients are updated then getNameStr() should be renamed to
getName(). PR5218.