Douglas Gregor [Wed, 4 Aug 2010 05:53:38 +0000 (05:53 +0000)]
When we try (but fail) to build a precompiled preamble, wait for a
short "cooling off" period (defaulting to 5 reparses) before trying to
build a precompiled preamble again. Previously, if we failed to build
the precompiled preamble at any time, we just gave up the whole
charade any never tried again.
John McCall [Tue, 3 Aug 2010 22:46:07 +0000 (22:46 +0000)]
Do a very simple pass over every function we emit to infer whether we can
mark it nounwind based on whether it contains any non-nounwind calls.
<rdar://problem/8087431>
Tom Care [Tue, 3 Aug 2010 21:24:13 +0000 (21:24 +0000)]
Improved false positive detection and numerous small issues in UnreachableCodeChecker
- Reporting now uses getUnreachableStmt which returns the Stmt* we should report
- Indexing of reachable and visited blocks now use CFGBlock ID's instead of pointers
- The CFG used in the unreachable search is now the unoptimized CFG
- Added 'Dead code' category to warnings
- Removed obsolete function getCondition
- Simplified false positive detection based on properties of FindUnreachableEntryPoints
Jordy Rose [Tue, 3 Aug 2010 20:44:35 +0000 (20:44 +0000)]
Makes GRState::makeWithStore private, to encourage clients to make store changes through GRState instead of directly accessing the StoreManager. Also adds cover methods for InvalidateRegion(s) and EnterStackFrame to GRState.
This is in preparation for proposed region change notifications. No functionality change.
Douglas Gregor [Tue, 3 Aug 2010 19:06:41 +0000 (19:06 +0000)]
When using a precompiled preamble, keep track of the top-level
declarations that we saw when creating the precompiled preamble, and
provide those declarations in addition to the declarations parsed in
the main source file when traversing top-level declarations. This
makes the use of precompiled preambles a pure optimization, rather
than changing the semantics of the parsed translation unit.
Apart from storing/retrieving the previous redeclaration from PCH, also store/retrieve the most recent
redeclaration. That way we are sure that the full redeclarations chain is loaded.
When using chained PCHs, first declarations point to the most recent redeclarations in the same PCH.
To address this use a REDECLS_UPDATE_LATEST record block to keep track of which first declarations need
to point to a most recent redeclaration in another PCH.
Support x86 AVX 256-bit instructions built-ins. Right now support all of them, but
as soon as we properly codegen the simple vector operations, remove the
unnecessary built-ins/intrinsics from clang and llvm. Also add tests for the new
built-ins
Tom Care [Tue, 3 Aug 2010 01:55:07 +0000 (01:55 +0000)]
Changed GRExprEngine to pass down a reference to itself when checkers are doing postanalysis. This allows the checker to gather information about the state of the engine when it has finished.
- Exposed the worklist and BlockAborted flag in GRCoreEngine
- Changed postanalysis checkers to use the new infrastructure
Ted Kremenek [Mon, 2 Aug 2010 23:46:59 +0000 (23:46 +0000)]
Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to the original
CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)').
Ted Kremenek [Mon, 2 Aug 2010 21:59:12 +0000 (21:59 +0000)]
Fix idempotent operations false positive caused by ivars not being invalidated in function
calls when the enclosing object had retain/release state. Fixes <rdar://problem/8261992>.
Douglas Gregor [Mon, 2 Aug 2010 20:51:39 +0000 (20:51 +0000)]
When using a precompiled preamble, save the diagnostics produced when
creating the preamble and "replay" them when reusing the
preamble. Also, fix a thinko in the copying of the preamble when
building the precompiled preamble.
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.