Douglas Gregor [Mon, 19 Apr 2010 18:02:19 +0000 (18:02 +0000)]
When searching for code-completion and typo-correction candidates,
look from an Objective-C class or category to its implementation, to
pick up synthesized ivars. Fixes a problem reported by David
Chisnall.
Douglas Gregor [Sun, 18 Apr 2010 18:11:38 +0000 (18:11 +0000)]
Make sure that we don't visit redeclarations of nested classes while
instantiating class members as part of an explicit
instantiation. Addresses a compilation problem in
Boost.Serialization.
Douglas Gregor [Sun, 18 Apr 2010 17:37:40 +0000 (17:37 +0000)]
C++ [namespace.memdef]p3 only applies when the friend is not named via
a qualified name. We weren't checking for an empty
nested-name-specifier when dealing with friend class templates
(although we were checking in the other places where we deal with this
paragraph). Fixes a Boost.Serialization showstopper.
Benjamin Kramer [Sun, 18 Apr 2010 12:05:54 +0000 (12:05 +0000)]
Bail out early to avoid comparing the internals of two conversion sequences of
different kinds (aka garbage). This happens if we're comparing a standard
conversion sequence to an ambiguous one which have the same KindRank.
Douglas Gregor [Sun, 18 Apr 2010 09:22:00 +0000 (09:22 +0000)]
When performing reference initialization for the purposes of overload
resolution ([over.ics.ref]), we take some shortcuts required by the
standard that effectively permit binding of a const volatile reference
to an rvalue. We have to treat lightly here to avoid infinite
recursion.
Fix the access checking of function and function template argument types,
return types, and default arguments. This fixes PR6855 along with several
similar cases where we rejected valid code.
Douglas Gregor [Sun, 18 Apr 2010 07:57:34 +0000 (07:57 +0000)]
When checking the copy constructor for the optional copy during a
reference binding to an rvalue of reference-compatible type, check
parameters after the first for complete parameter types and build any
required default function arguments. We're effectively simulating the
type-checking for a call without building the call itself.
Douglas Gregor [Sun, 18 Apr 2010 07:40:54 +0000 (07:40 +0000)]
In C++98/03, when binding a reference to an rvalue of
reference-compatible type, the implementation is permitted to make a
copy of the rvalue (or many such copies, even). However, even though
we don't make that copy, we are required to check for the presence of
a suitable copy constructor. With this change, we do.
Note that in C++0x we are not allowed to make these copies, so we test
both dialects separately.
Also note the FIXME in one of the C++03 tests, where we are not
instantiating default function arguments for the copy constructor we
pick (but do not call). The fix is obvious; eliminating the infinite
recursion it causes is not. Will address that next.
Douglas Gregor [Sun, 18 Apr 2010 02:16:12 +0000 (02:16 +0000)]
Do not consider explicit constructors when performing a copy to a
temporary object. This is blindingly obvious from reading C++
[over.match.ctor]p1, but somehow I'd missed it and it took DR152 to
educate me. Adjust one test that was relying on this non-standard
behavior.
Anders Carlsson [Sat, 17 Apr 2010 22:54:57 +0000 (22:54 +0000)]
Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
Douglas Gregor [Sat, 17 Apr 2010 22:01:05 +0000 (22:01 +0000)]
Improve our handling of user-defined conversions as part of overload
resolution. There are two sources of problems involving user-defined
conversions that this change eliminates, along with providing simpler
interfaces for checking implicit conversions:
- It eliminates a case of infinite recursion found in Boost.
- It eliminates the search for the constructor needed to copy a temporary
generated by an implicit conversion from overload
resolution. Overload resolution assumes that, if it gets a value
of the parameter's class type (or a derived class thereof), there
is a way to copy if... even if there isn't. We now model this
properly.
Add support for '-fgnu-keywords' and '-fasm' to Clang's driver. They are not
implemented precisely the same as GCC, but the distinction GCC makes isn't
useful to represent. This allows parsing code which uses GCC-specific keywords
('asm', etc.) without parsing in a fully GNU mode.
Eric Christopher [Sat, 17 Apr 2010 02:26:23 +0000 (02:26 +0000)]
Consolidate most of the integer constant expression builtin requirement
checking into a single function and use that throughout. Remove some
now unnecessary diagnostics and update tests with now more accurate
diagnostics.
Chris Lattner [Fri, 16 Apr 2010 23:34:13 +0000 (23:34 +0000)]
make our existing "switch on bool" warning work for C. Since
the result of comparisons are 'int' in C, it doesn't work to
test just the result type of the expression.
Douglas Gregor [Fri, 16 Apr 2010 23:28:44 +0000 (23:28 +0000)]
If a non-noreturn virtual member function is guaranteed not to return,
do *not* suggest that the function could be attribute 'noreturn';
overridden functions may end up returning.
Douglas Gregor [Fri, 16 Apr 2010 22:09:46 +0000 (22:09 +0000)]
Collapse the three separate initialization paths in
TryStaticImplicitCast (for references, class types, and everything
else, respectively) into a single invocation of
InitializationSequence.
One of the paths (for class types) was the only client of
Sema::TryInitializationByConstructor, which I have eliminated. This
also simplified the interface for much of the cast-checking logic,
eliminating yet more code.
I've kept the representation of C++ functional casts with <> 1
arguments the same, despite the fact that I hate it. That fix will
come soon. To satisfy my paranoia, I've bootstrapped + tested Clang
with these changes.
Rework USR generation for symbols with no linkage. Many of the USRs are now shortened,
and we now include the file name that declares the symbol with no linkage in the USR.
USRs for such symbols are generated only in restructed cases, e.g., anonymous enum declarations,
typedefs, etc.
add another test for the undef patch just for to have peace of mind :)
this follows from C99 6.7.8p10: if it is a union, the first named member is initialized
Chris Lattner [Fri, 16 Apr 2010 21:02:32 +0000 (21:02 +0000)]
fix a bogus assertion exposed by a recent change: packing the
struct may cause it to shrink more than one byte. Before
my recent changes we compiled the new test into:
%0 = type { [6 x i8] }
@x = global %0 { [6 x i8] undef }, align 2 ; <%0*> [#uses=0]
which is obviously bogus. Now we compile it into:
%0 = type <{ i32, i8, i8 }>
@x = global %0 zeroinitializer, align 2 ; <%0*> [#uses=0]
Douglas Gregor [Fri, 16 Apr 2010 19:30:02 +0000 (19:30 +0000)]
Switch the checking of implicit casts for static_cast, C-style, and
functional casts over to InitializationSequence, eliminating a caller
of Sema::TryImplicitConversion. We also get access and ambiguity
checking "for free".
Nick Lewycky [Fri, 16 Apr 2010 18:49:45 +0000 (18:49 +0000)]
Add a write(raw_ostream&) method to RewriteBuffer. This uses an inefficient
implementation today but is the right place if we want to make it faster some
day.
Dan Gohman [Fri, 16 Apr 2010 16:28:05 +0000 (16:28 +0000)]
Remove this hard-coded buffer size. In some basic experiments preprocessing
large files, this doesn't seem significantly better than just letting
raw_ostream pick a buffer size.
This code predates raw-ostream's automatic buffer sizing; in fact, it
was introduced as part of the code which would eventually become
raw_ostream.
Dan Gohman [Fri, 16 Apr 2010 04:45:02 +0000 (04:45 +0000)]
Convert libCIndex to use the new native EXPORTED_SYMBOL_FILE mechanism.
libCIndex also has a CMakeLists.txt file which has its own code for using
the exports file. To preserve existing functionality, create a separate
darwin-specific exports file for use by this CMakeLists.txt code.
Douglas Gregor [Fri, 16 Apr 2010 00:23:51 +0000 (00:23 +0000)]
Fix a bug in caret-line-pruning logic that only happens when we have a
source line wider than the terminal where the associated fix-it line
is longer than the caret line. Previously, we would crash in this
case, which was rather unfortunate. Fixes <rdar://problem/7856226>.
Douglas Gregor [Thu, 15 Apr 2010 23:40:53 +0000 (23:40 +0000)]
Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.
This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).
Douglas Gregor [Thu, 15 Apr 2010 22:33:43 +0000 (22:33 +0000)]
Feed proper source-location information into Sema::LookupSingleResult,
in case it ends up doing something that might trigger diagnostics
(template instantiation, ambiguity reporting, access
reporting). Noticed while working on PR6831.
Do not generate USRs for declarations with 'no linkage' except for enums, structs, typedefs.
Those still need work to disambiguate them across translation units.
Fix PR 6844, a regression caused by the introduction of llvm_unreachable for the default
case in GRExprEngine::Visit (in r101129). Instead, enumerate all Stmt cases and have
no 'default' case in the switch statement. When we encounter a Stmt we don't handle,
we should explicitly add it to the switch statement.
Douglas Gregor [Thu, 15 Apr 2010 15:53:31 +0000 (15:53 +0000)]
Fix a few cases where enum constant handling was using
ASTContext::getTypeSize() rather than ASTContext::getIntWidth() for
the width of an integral type. The former includes padding for bools
(to the target's size) while the latter does not, so we woud end up
zero-extending bools to the target width when we shouldn't. Fixes a
crash-on-valid in the included test.