Douglas Gregor [Tue, 2 Aug 2011 16:26:37 +0000 (16:26 +0000)]
Implement a proper local -> global type ID remapping scheme in the AST
reader. This scheme permits an AST file to be loaded with its type IDs
shifted anywhere in the type ID space.
At present, the type indices are still allocated in the same boring
way they always have been, just by adding up the number of types in
each PCH file within the chain. However, I've done testing with this
patch by randomly sliding the base indices at load time, to ensure
that remapping is occurring as expected. I may eventually formalize
this in some testing flag, but loading multiple (non-chained) AST
files at once will eventually exercise the same code.
There is one known problem with this patch, which involves name lookup
of operator names (e.g., "x.operator int*()") in cases where multiple
PCH files in the chain. The hash function itself depends on having a
stable type ID, which doesn't happen with chained PCH and *certainly*
doesn't happen when sliding type IDs around. We'll need another
approach. I'll tackle that next.
Douglas Gregor [Tue, 2 Aug 2011 11:12:41 +0000 (11:12 +0000)]
Add a debugging dump for Module (also emitted as part of the AST
reader statistics), to show the local-to-global mappings. The only
such mapping we have (at least, for now) is for source location
offsets.
Douglas Gregor [Tue, 2 Aug 2011 10:56:51 +0000 (10:56 +0000)]
Generalize the module offset map to include mapping information for
all of the kinds of IDs that can be offset. No effectively
functionality change; this is preparation for adding remapping for
IDs.
Bob Wilson [Mon, 1 Aug 2011 23:39:04 +0000 (23:39 +0000)]
Revert "Re-enable byval for ARM in clang. rdar://problem/7662569"
This reverts commit 67d097e1232b7d66f58989c16a45b8a11721f76e.
We found a miscompile with ARM byval, which is still being investigated.
In the meantime, this works around the problem by disabling ARM byval.
Anna Zaks [Mon, 1 Aug 2011 22:40:01 +0000 (22:40 +0000)]
Add a skeleton for the Keychain Services API Checker. Register it as OSX experimental for now. Note, the checker still does not handle tracking of escaped values, taking into account the return value of the allocator functions, nor the actual bug reporting..
Akira Hatanaka [Mon, 1 Aug 2011 20:48:01 +0000 (20:48 +0000)]
Implement MipsABIInfo::EmitVAArg. This fix enables clang to complete compilation
without bailing out when va_arg is an aggregate expression. However,
alignment checking needs to be added in isSafeToEliminateVarargsCast in
InstCombineCalls.cpp in order to produce correct mips code (see link below).
Chad Rosier [Mon, 1 Aug 2011 19:58:48 +0000 (19:58 +0000)]
Driver: When compiling i386 -fapple-kext code, we fallback to llvmgcc.
Unfortunately, llvmgcc doesn't always work when writing temporary output to
/dev/null. Therefore, create a temp file that is later deleted.
rdar://9837692
Not sure why we bother updating FunctionDecl's EndRangeLoc in FunctionDecl::setParams.
EndRangeLoc should always be set to at least the ending paren or brace.
[libclang] Annotation of parameters that got default args from a previous declarations was
broken because the end location of the parameter was the end location of the default arg,
resulting in a source range that could begin in one file and end in another.
Douglas Gregor [Sat, 30 Jul 2011 08:57:03 +0000 (08:57 +0000)]
Introduce a Fix-It for the "missing sentinel" warning, adding an
appropriate sentinel at the end of the argument list. Also, put the
sentinel warnings under -Wsentinel. Fixes <rdar://problem/8764236>.
Douglas Gregor [Sat, 30 Jul 2011 08:17:44 +0000 (08:17 +0000)]
When producing code completion results for variadic macros, fold the
variadic bit (", ..." or ", args...") into the prior placeholder, like
we do with functions and methods. Fixes <rdar://problem/9740808>.
Douglas Gregor [Sat, 30 Jul 2011 07:55:26 +0000 (07:55 +0000)]
Add the various parameter-passing keywords for Distributed Objects
(such as in, inout, byref, and oneway) to code completion
results. Fixes <rdar://problem/8844158>.
Douglas Gregor [Sat, 30 Jul 2011 07:01:49 +0000 (07:01 +0000)]
Turn off __has_feature(is_empty) and __has_feature(is_pod) if the
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.
Douglas Gregor [Sat, 30 Jul 2011 06:55:39 +0000 (06:55 +0000)]
When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.
Douglas Gregor [Sat, 30 Jul 2011 06:45:27 +0000 (06:45 +0000)]
When complaining about a non-POD second argument to va_arg, use a
special diagnostic for ARC ownership-qualified types. We wouldn't want
to expose Objective-C programmers to the term "POD", would we? Fixes
<rdar://problem/9772982>.
Douglas Gregor [Sat, 30 Jul 2011 06:28:34 +0000 (06:28 +0000)]
Use the "Bar.h" -> <Foo/Bar.h> remapping for index header maps only as
a fallback, if normal header search fails. Another attempt at
<rdar://problem/9824020>.
Douglas Gregor [Fri, 29 Jul 2011 23:31:30 +0000 (23:31 +0000)]
Teach the ASTImporter to cope with cases where we have already
imported a forward declaration, but later the full definition of the
same entity becomes available. When this happens, import the definition.
Douglas Gregor [Fri, 29 Jul 2011 20:21:18 +0000 (20:21 +0000)]
On Darwin, libc++ may be installed alongside the compiler in
lib/c++/v1. Look there first, before falling back to the normal
/usr/include/c++/v1. <rdar://problem/9866149>
Douglas Gregor [Fri, 29 Jul 2011 00:56:45 +0000 (00:56 +0000)]
In the ASTReader, replace the continuous range maps whose value types
were (Module*, Offset) with equivalent maps whose value type is just a
Module*. The offsets have moved into corresponding "Base" fields
within the Module itself, where they will also be helpful for
local->global translation (eventually).
Fix assertion failure in CodeGen where the input operand to an asm
instruction is tied to an output operand which is a pointer, and
the input operand is narrower than the output operand.
Fix an inconsistency in Sema::ConvertArgumentsForCall in that
the callee note diagnostic was not emitted in the case where
there were too few arguments.
Douglas Gregor [Fri, 29 Jul 2011 00:21:44 +0000 (00:21 +0000)]
Move the base type ID from the ASTReader's global type map into the
Module itself, which makes more sense. This pattern to be repeated
several more times.
objective-c: warn if implementation of a method in category
masks an existing method in its primary class, class extensions,
and primary class's non-optional protocol methods; as primary
class, or one of its subclass's will implement this method.
This warning has potential of being noisy so it has its own
group. // rdar://7020493
Really remove FlatStoreManager and BasicStoreManager, this time from the driver. Also remove associated tests. Sorry for the messy commits; this is the result of a botched Git merge.
[analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs.
The motivation of this large change is to drastically simplify the logic in ExprEngine going forward.
Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will
need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings
will be called frequently; this can also be improved over time.
Douglas Gregor [Thu, 28 Jul 2011 22:39:26 +0000 (22:39 +0000)]
Introduce the local-global mapping for preprocessed entities, and use
it appropriately. Also, patch up a place where we were failing to map
local macro definition IDs into global macro definition IDs.
Richard Trieu [Thu, 28 Jul 2011 20:30:10 +0000 (20:30 +0000)]
Fix a test case that was intermittently failing. The issue was that instantiations are not stored in an order preserving structure, so the print order may be impacted. Modified test case to do two FileCheck passes to ensure that both instantiations are in the same place.
Test originially commited at r136306 and temporarily silenced at r136348.
Added basic parsing for all remaining attributes, thread safety
analysis. This includes checking that the attributes are applied in the
correct contexts and with the correct number of arguments.
Douglas Gregor [Thu, 28 Jul 2011 19:49:54 +0000 (19:49 +0000)]
Make the deserialization of Sema::PendingInstantiations lazy. At this
point, ASTReader::InitializeSema() has very little interesting work,
*except* issues stemming from preloaded declarations. That's something
we'll still need to cope with.
Douglas Gregor [Thu, 28 Jul 2011 19:26:52 +0000 (19:26 +0000)]
Promote the deserialized PendingInstantiations vector from being a
Module member to being an ASTReader member; we want it to be
centralized for lazy deserialization.
Douglas Gregor [Thu, 28 Jul 2011 19:11:31 +0000 (19:11 +0000)]
Lazily deserialize Sema::VTableUses. Plus, fix the utterly and
completely broken deserialization mapping code we had for VTableUses,
which would have broken horribly as soon as our local-to-global ID
mapping became interesting.
Switch the ModuleManager over to using a FileManager and FileEntry* as part of its lookup instead of the filename. This is a more correct unique identifier, as symlinks can be handled by the FileManager.
Douglas Gregor [Thu, 28 Jul 2011 14:41:43 +0000 (14:41 +0000)]
Move a Module's ReferencedSelectorsData into the ASTReader itself, so
that it accumulates referenced selectors from each of the modules/PCH
files as they are loaded. No actual functionality change, yet.
Douglas Gregor [Thu, 28 Jul 2011 14:20:37 +0000 (14:20 +0000)]
Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,
we could turn this into an on-disk hash table so we don't load the
whole thing the first time we need it. However, it tends to be very,
very small (i.e., empty) for most precompiled headers, so it isn't all
that interesting.
John McCall [Thu, 28 Jul 2011 07:23:35 +0000 (07:23 +0000)]
Fix a couple of problems with initialization and assignment to
__block variables where the act of initialization/assignment
itself causes the __block variable to be copied to the heap
because the variable is of block type and is being assigned
a block literal which captures the variable.
Douglas Gregor [Thu, 28 Jul 2011 04:45:53 +0000 (04:45 +0000)]
Introduce the "-index-header-map" option, to give special semantics
for quoted header lookup when dealing with not-yet-installed
frameworks. Fixes <rdar://problem/9824020>.
Cut down the number of open/close system calls for output files.
For PCH files, have only one open/close for temporary + rename to be safe from race conditions.
For all other output files open/close the output file directly.
Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374.