Douglas Gregor [Tue, 9 Nov 2010 20:03:54 +0000 (20:03 +0000)]
Revert the fix for PR8013.
That bug concerned the well-formedness of code such as (&ovl)(a, b,
c). GCC rejects the code, while EDG accepts it. On further study of the
standard, I see no support for EDG's position: in particular, C++
[over.over] does not list this as a context where we can take the
address of an overloaded function, C++ [over.call.func] does not
reference the address-of operator at any point, and C++ [expr.call]
claims that the function argument in a call is either a function
lvalue or a pointer-to-function; (&ovl) is neither.
Charles Davis [Tue, 9 Nov 2010 18:04:24 +0000 (18:04 +0000)]
Use the right calling convention when mangling names in the Microsoft C++
mangler. Now member functions and pointers thereof have their calling
convention mangled as __thiscall if they have the default CC (even though,
they technically still have the __cdecl CC).
Douglas Gregor [Tue, 9 Nov 2010 06:24:54 +0000 (06:24 +0000)]
ntroduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.
I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.
Take 2: this time, adjusted tests appropriately and used a "simple"
approach to the spelling location.
Douglas Gregor [Tue, 9 Nov 2010 05:28:47 +0000 (05:28 +0000)]
Introduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a
macro. clang_getInstantiationLocation() tells where we instantiated
the macro.
I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs,
since they gloss over macro-instantiation information.
Douglas Gregor [Tue, 9 Nov 2010 03:59:40 +0000 (03:59 +0000)]
Teach code completion not to include out-of-line declarations and
definitions in its results. The original declarations will be visible
wherever they are declared.
John McCall [Tue, 9 Nov 2010 01:18:05 +0000 (01:18 +0000)]
When re-using a vtable slot for the nearest overridden method, just because
there's no return adjustment from the overridden to the overrider doesn't
mean there isn't a return adjustment from the overrider to the final
overrider. This matters if we're emitting a virtual this-adjustment thunk
because the overrider virtually inherits from the class providing the
nearest overridden method. Do the appropriate return adjustment in this case.
Nick Lewycky [Tue, 9 Nov 2010 00:19:31 +0000 (00:19 +0000)]
Fix warning about unused variable 'Fn' in no-asserts builds. Also reflow this
block so that it looks more like the rest of the file. No functional change.
Ted Kremenek [Mon, 8 Nov 2010 21:14:15 +0000 (21:14 +0000)]
Add CursorVisitor::VisitBinaryOperator() to explicitly handle the case where we can blow out the stack due
to deeply nested BinaryOperators. This is done by turning the explicit recursion into being data recursive.
Douglas Gregor [Mon, 8 Nov 2010 21:12:30 +0000 (21:12 +0000)]
If an instance method messages is sending to an expression of type Class,
and we statically can compute a bound on the actual type (e.g.,
because it's a send to the the magic "class" instance method), code
complete as if we were performing a class message send to that class.
John McCall [Mon, 8 Nov 2010 19:48:17 +0000 (19:48 +0000)]
Document Clang's support for attributes on individual enumerators and
tweak the documentation for deprecation-with-message. Provide __has_feature
tests for both. rdar://problem/8605692
Douglas Gregor [Mon, 8 Nov 2010 17:16:59 +0000 (17:16 +0000)]
Improve our handling of C++ [class.copy]p3, which specifies that a
constructor template will not be used to copy a class object to a
value of its own type. We were eliminating all constructor templates
whose specializations look like a copy constructor, which eliminated
important candidates. Fixes PR8182.
Douglas Gregor [Mon, 8 Nov 2010 15:20:28 +0000 (15:20 +0000)]
When attempting reference binding to an overloaded function, also
consider that we might be trying to bind a reference to a class type,
which involves a constructor call. Fixes PR7425.
Douglas Gregor [Sun, 7 Nov 2010 23:05:16 +0000 (23:05 +0000)]
Remove broken support for variadic templates, along with the various
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.
But don't get too excited about that happening now.
Use ld directly on linux. Changes from the previous try:
*) Try to detect as much as possible from the system itself, not the distro.
This should make it easier to port to a new distro and more likely to
work on a unknown one.
*) The distro enum now doesn't include the arch. Just use the existing
host detection support in LLVM.
*) Correctly handle --sysroot.
A small regression is that now clang will pass bitcode file to the linker.
This is necessary for the gold plugin support to work.
It might be better to detect this at configure/cmake time, but doing it in
c++ first is a lot easier.
John McCall [Sat, 6 Nov 2010 09:44:32 +0000 (09:44 +0000)]
Simplify the logic for emitting guard variables for template static
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global. Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.
The callback info for #if/#elif is not great -- ideally it would give
us a list of tokens in the #if, or even better, a little parse tree.
But that's a lot more work. Instead, clients can retokenize using
Lexer::LexFromRawLexer().
When determining which template partial specialization is more specialized,
make sure to setup the instantiation stack. Fixes rdar://8620775 & http://llvm.org/PR8234
Douglas Gregor [Fri, 5 Nov 2010 23:22:45 +0000 (23:22 +0000)]
When searching for an instantiated declaration requires instantiation
of its parent context, be sure to update the parent-context pointer
after instantiation. Fixes two anonymous-union instantiation issues in
<rdar://problem/8635664>.
Douglas Gregor [Fri, 5 Nov 2010 22:21:31 +0000 (22:21 +0000)]
Check for an invalid field earlier in a constructor's initialization
of that field. Otherwise, we can end up building and later trying to
instantiate a dependent member initializer that will fail at
instantiation time.
Unfortunately, I've only managed to trigger this bug with very large
sources, so there's no test case :(
Douglas Gregor [Fri, 5 Nov 2010 21:11:19 +0000 (21:11 +0000)]
Teach clang_getCursorReferenced() that a
CXXConstructorExpr/CXXTemporaryObjectExpr references the constructor
it calls. Then, tweak clang_getCursor() to prefer such a call over a
type reference to the type being called.
Douglas Gregor [Thu, 4 Nov 2010 00:09:33 +0000 (00:09 +0000)]
When canonicalizing nested-name-specifiers involving dependent names
or dependent specializations, rip apart the dependent name/dependent
specialization to recanonicalize its pieces, because
nested-name-specifiers store "dependent-type::identifier" differently
than types do. Fixes PR7419.
When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.
--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
file operations will be abstracted in the future for the reproduction mechanism.
FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.
Douglas Gregor [Wed, 3 Nov 2010 17:00:07 +0000 (17:00 +0000)]
When producing overload candidates for binary built-in operators, keep
the sets of available conversions for the first and second arguments
separate. This is apparently the indent of C++ [over.built], and
reduces the number of overload candidates generated, eliminating some
ambiguities. Fixes PR8477.
David Chisnall [Wed, 3 Nov 2010 14:12:26 +0000 (14:12 +0000)]
Added cursor visitor that takes a block as an argument. Tested compiling
libclang with both clang -fblocks and gcc (no blocks support). Only exposed in
the header to compilers that do have blocks support.