John McCall [Thu, 5 Aug 2010 20:39:18 +0000 (20:39 +0000)]
It turns out that linkers (at least, the Darwin linker) don't necessarily
do the right thing with mixed-visibility symbols, so disable the visibility
optimization where that's possible, i.e. with template classes (since it's
possible that an arbitrary template might be subject to an explicit
instantiation elsewhere). 447.dealII actually does this.
I've put the code under an option that's currently not hooked up to anything.
Douglas Gregor [Thu, 5 Aug 2010 09:09:23 +0000 (09:09 +0000)]
Give clang_codeCompleteAt() an "options" parameter, and add a new
flags enumeration + default-generating function that allows
code-completion to be customized via the libclang API.
Plus, turn on spell-checking when performing code completion.
John McCall [Thu, 5 Aug 2010 09:05:08 +0000 (09:05 +0000)]
TDK_InconsistentQuals is really totally different from TDK_Inconsistent.
Rename it to TDK_Underqualified to avoid this sort of confusion and give it
its own diagnostic.
Nick Lewycky [Thu, 5 Aug 2010 06:27:49 +0000 (06:27 +0000)]
Remove the warning for variables declared in the if-expression being used in
the else clause. The problem is that it's overly zealous and will respond to
uses in assignments, or after assignments. We should bring this back once we
can do it right. Fixes PR7100.
John McCall [Thu, 5 Aug 2010 04:58:04 +0000 (04:58 +0000)]
operator<< on a DiagnosticBuilder should *always* output exactly one thing.
Null template arguments are bad, but they're better than crashing with an
argument mismatch.
Eli Friedman [Thu, 5 Aug 2010 02:49:48 +0000 (02:49 +0000)]
Get rid of isObjectType; when C++ says "object type", it generally
just means "not a function type", not "not a function type or void". This
changes behavior slightly, but generally in a way which accepts more code.
Ted Kremenek [Thu, 5 Aug 2010 00:19:24 +0000 (00:19 +0000)]
Correctly handle 'Class<...>' when examining Cocoa conventions in the static analyzer. Fixes a crash reported in <rdar://problem/8272168>. Patch by Henry Mason!
John McCall [Wed, 4 Aug 2010 23:46:35 +0000 (23:46 +0000)]
Extend the visibility-hidden optimization to linkonce_odr thunks for
functions with in-line definitions, since such thunks will be emitted at any
use of the function.
Completes the feature work for rdar://problem/7523229.
Ted Kremenek [Wed, 4 Aug 2010 20:01:07 +0000 (20:01 +0000)]
Teach SemaChecking::CheckReturnStackAddr about ImplicitCastExprs that convert values to an lvalue. This allows us to warn (again) about returning references to stack variables. (fixes PR 7812).
Douglas Gregor [Wed, 4 Aug 2010 17:07:00 +0000 (17:07 +0000)]
When performing in-process code completion, don't free the remapped
file buffers until the code completion results are destroyed;
diagnostics may end up referring into the source.
Douglas Gregor [Wed, 4 Aug 2010 16:47:14 +0000 (16:47 +0000)]
Add code-completion support directly to ASTUnit, which performs code
completion within the translation unit using the same command-line
arguments for parsing the translation unit. Eventually, we'll reuse
the precompiled preamble to improve code-completion performance, and
this also gives us a place to cache results.
Expose this function via the new libclang function
clang_codeCompleteAt(), which performs the code completion within a
CXTranslationUnit. The completion occurs in-process
(clang_codeCompletion() runs code completion out-of-process).
John McCall [Wed, 4 Aug 2010 08:34:44 +0000 (08:34 +0000)]
Emit standard-library RTTI with external linkage, not weak_odr.
Apply hidden visibility to most RTTI; libstdc++ does not rely on exact
pointer equality for the type info (just the type info names). Apply
the same optimization to RTTI that we do to vtables.
Jordy Rose [Wed, 4 Aug 2010 07:10:57 +0000 (07:10 +0000)]
Change the checker callback cache in GRExprEngine to be more compact (and IMHO a little easier to understand), and add the same sort of caching for EvalAssume (tied for least-used callback), mostly as proof-of-concept.
Before we go further with these, we should figure out a way to reuse the visit-and-cache code in CheckerVisit.
John McCall [Wed, 4 Aug 2010 05:59:32 +0000 (05:59 +0000)]
Some more correctness fixes and code-size optimizations for fragile-ABI
ObjC exceptions:
- don't enter a try for the catch blocks unless there's a finally
- put the setjmp buffer in the locals set for liveness reasons
- dump the sync object into an alloca in the locals set for liveness reasons
Some of this can go away if the backend starts to properly calculate liveness
in the presence of setjmp (which would also be a *much* stabler solution).
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.