Sebastian Redl [Mon, 2 Aug 2010 18:30:12 +0000 (18:30 +0000)]
Query only the latest version of an identifier in the PCH chain. Make sure this version holds the entire declaration chain. This is a much saner solution than trying to merge the info from all elements, and makes redeclarations work properly. Expand the declarations test case to cover more compliated cases.
Sebastian Redl [Mon, 2 Aug 2010 18:27:05 +0000 (18:27 +0000)]
Remove mutable data on TagType and InjectedClassNameType, by instead walking the declaration chain in search of a definition. This is necessary for a sane chained PCH implementation. No observable performance change on Carbon.h syntax-only, and bootstraps cleanly.
Daniel Dunbar [Mon, 2 Aug 2010 15:31:28 +0000 (15:31 +0000)]
Frontend: Change PluginASTAction::ParseArgs to take a CompilerInstance object
for use in reporting diagnostics.
- We don't want to use the Action's own CompilerInstance, because that is only
initialized during file processing and I like that invariant.
Also, if ParseArgs returns false then abandon execution.
Daniel Dunbar [Mon, 2 Aug 2010 05:43:51 +0000 (05:43 +0000)]
Driver: Give Build{Universal,}Actions access to the default host tool chain. I
avoided this originally to enforce that the driver actions aren't toolchain
dependent, but it isn't worth the cumbersone additional hostinfo split.
Zhongxing Xu [Mon, 2 Aug 2010 04:56:14 +0000 (04:56 +0000)]
Improve flat store: MemRegion::getAsOffset() computes a region's offset within
the top-level object. FlatStore now can bind and retrieve element and field
regions.
PR7297 is fixed by flat store.
Daniel Dunbar [Sun, 1 Aug 2010 22:29:51 +0000 (22:29 +0000)]
Driver: Keep track of a separate "install dir", which is the path where clang
was invoked from (which may not be where the executable itself is).
- This allows having e.g., /Developer/usr/bin/clang be a symlink to some other
location, while still making sure the Driver finds 'as', 'ld', etc. relative
to itself.
Eli Friedman [Sun, 1 Aug 2010 22:13:15 +0000 (22:13 +0000)]
PR7777: Set EnabledByDefault to something useful, instead of setting it
randomly. This makes us consistently show "-pedantic" as the warning option
for a warning where appropriate.
John McCall [Sun, 1 Aug 2010 20:20:59 +0000 (20:20 +0000)]
Make a first pass at implementing -Wglobal-constructors. I'm worried that this
will end up bizarrely mirroring CGExprConstant, but that might be the hazard of
this feature.
John McCall [Sun, 1 Aug 2010 00:26:45 +0000 (00:26 +0000)]
Only run the jump-checker if there's a branch-protected scope *and* there's
a switch or goto somewhere in the function. Indirect gotos trigger the
jump-checker regardless, because the conditions there are slightly more
elaborate and it's too marginal a case to be worth optimizing.
Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918
John McCall [Sat, 31 Jul 2010 23:20:56 +0000 (23:20 +0000)]
Fix fragile-ABI ObjC exceptions in the presence of optimization with
the magic of inline assembly. Essentially we use read and write hazards
on the set of local variables to force flushing locals to memory
immediately before any protected calls and to inhibit optimizing locals
across the setjmp->catch edge. Fixes rdar://problem/8160285
Douglas Gregor [Sat, 31 Jul 2010 00:40:00 +0000 (00:40 +0000)]
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.
Add specialisation iterators for {Class,Function}TemplateDecl
This patch introduces the ClassTemplateDecl::spec_{begin,end}()
and FunctionTemplateDecl::{,partial_}spec_{begin,end}() member
functions as a public interface for iterating over the declarations'
specialisation sets.
Refactor find*Specialization functions using SpecEntryTraits
This patch reimplements the find*Specialization family of member
functions of {Class,Function}TemplateDecl in terms of a common
implementation that uses SpecEntryTraits to obtain the most recent
declaration.
When we are deserializing the lexical decls of a DeclContext from PCH, notify the PCHReader to hold off passing Decls
to the consumer until the DeclContext is fully prepared.
Before, due to recursive loading, we could be in a situation where we would try to deserialize the decls of a DeclContext which was already doing that, and bad things would happen. In the specific case I encountered, the lexical decls would
form a cycle and we would enter infinite loop territory.
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.
Chris Lattner [Fri, 30 Jul 2010 04:02:24 +0000 (04:02 +0000)]
fix PR5179 and correctly fix PR5831 to not miscompile.
The X86-64 ABI code didn't handle the case when a struct
would get classified and turn up as "NoClass INTEGER" for
example. This is perfectly possible when the first slot
is all padding (e.g. due to empty base classes). In this
situation, the first 8-byte doesn't take a register at all,
only the second 8-byte does.
This fixes this by enhancing the x86-64 abi stuff to allow
and handle this case, reverts the broken fix for PR5831,
and enhances the target independent stuff to be able to
handle an argument value in registers being accessed at an
offset from the memory value.
This is the last x86-64 calling convention related miscompile
that I'm aware of.
Sebastian Redl [Fri, 30 Jul 2010 00:29:29 +0000 (00:29 +0000)]
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.
Daniel Dunbar [Thu, 29 Jul 2010 22:57:21 +0000 (22:57 +0000)]
Revert "Re-apply fixed version of 108749, correctly conditionalizing the new
sections on", this change uncovered a possible linker bug which resulted in the
wrong messages getting dispatched. Backing this out while we investigate...
Chris Lattner [Thu, 29 Jul 2010 18:39:32 +0000 (18:39 +0000)]
Implement the clang-side of detection for when to pass as
<2 x float> instead of double. This works but can't be turned
on until I teach codegen to pass <2 x float> as one XMM register
instead of two.
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.
Chris Lattner [Thu, 29 Jul 2010 18:13:09 +0000 (18:13 +0000)]
fix rdar://8251384, another case where we could access beyond the
end of a struct. This improves the case when the struct being passed
contains 3 floats, either due to a struct or array of 3 things. Before
we'd generate this IR for the testcase:
Chris Lattner [Thu, 29 Jul 2010 17:49:08 +0000 (17:49 +0000)]
start setting up infrastructure for passing multi-floats
as <2 x float> instead of as double. The backend isn't ready
yet, but infrastructure in the frontend can come up.
Chris Lattner [Thu, 29 Jul 2010 17:40:35 +0000 (17:40 +0000)]
rename Get8ByteTypeAtOffset -> GetINTEGERTypeAtOffset to
make it clear that this function should only return a type
that the codegen will classify the same as an INTEGER type.
Chris Lattner [Thu, 29 Jul 2010 17:04:54 +0000 (17:04 +0000)]
fix PR7742 / rdar://8250764, a miscompilation of struct
return where the struct has a base but no fields. This
was because the x86-64 abi logic was checking the wrong
predicate in one place.
This was introduced in r91874, which was a fix for PR5831,
which lacked a CHECK line, so I verified and added it.
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.
Douglas Gregor [Thu, 29 Jul 2010 16:05:45 +0000 (16:05 +0000)]
When taking the address of a value of Objective-C object type (e.g.,
one because we're referencing a variable of type NSString &), the
resulting type is an ObjCObjectPointerType.
Douglas Gregor [Thu, 29 Jul 2010 15:18:02 +0000 (15:18 +0000)]
Allow a looser form of compatibility checking (which ignores
qualifiers) when checking a K&R function definition against a previous
prototype. Fixes <rdar://problem/8193107>.