]> granicus.if.org Git - clang/log
clang
12 years ago[libclang] When printing the diagnostic print it with a new line.
Argyrios Kyrtzidis [Tue, 18 Oct 2011 15:13:14 +0000 (15:13 +0000)]
[libclang] When printing the diagnostic print it with a new line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142354 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Index method references.
Argyrios Kyrtzidis [Tue, 18 Oct 2011 15:13:11 +0000 (15:13 +0000)]
[libclang] Index method references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142353 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse llvm::Triple's methods to parse FreeBSD version numbers.
Benjamin Kramer [Tue, 18 Oct 2011 10:10:08 +0000 (10:10 +0000)]
Use llvm::Triple's methods to parse FreeBSD version numbers.

Who could've thought that FreeBSD would ever reach version 10!
Patch from Dimitry Andric.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142349 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAnother attempt at fixing format-strings-fixit.c.
Hans Wennborg [Tue, 18 Oct 2011 09:30:37 +0000 (09:30 +0000)]
Another attempt at fixing format-strings-fixit.c.

Use "%f" as format string to make sure it doesn't match size_t, etc.
whatever they might be typedeffed to, so that the fixit always applies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142348 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDisable the ssize_t test in format-strings-fixit.c.
Hans Wennborg [Tue, 18 Oct 2011 08:58:16 +0000 (08:58 +0000)]
Disable the ssize_t test in format-strings-fixit.c.

Turns out this part of the test from r142342 wasn't portable.
The errors on the bots look like this:

E:\bb-win7\cmake-clang-i686-msys\build\tools\clang\test\Sema\Output\format-strings-fixit.c.tmp:58:13: error: conversion specifies type 'unsigned int' but the argument has type 'ssize_t' (aka 'long')
  printf("%zd", (ssize_t) 42);
          ~~^   ~~~~~~~~~~~~
          %zd

Obviously we can't typedef ssize_t to someting that doesn't have the same size as size_t and expect it to work.

But it's also weird that the format string "%zd" gets interpreted as "unsigned int" when it should clearly be signed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142345 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSuggest %zu for size_t args to printf.
Hans Wennborg [Tue, 18 Oct 2011 08:10:06 +0000 (08:10 +0000)]
Suggest %zu for size_t args to printf.

For PR11152. Make PrintSpecifier::fixType() suggest "%zu" for size_t, etc.
rather than looking at the underlying type and suggesting "%llu" or other
platform-specific length modifiers. Applies to C99 and C++11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch to the C++11 warning flags in tests.
David Blaikie [Tue, 18 Oct 2011 05:54:07 +0000 (05:54 +0000)]
Switch to the C++11 warning flags in tests.
Patch by Ahmed Charles!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142340 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate documentation to use "C++11" instead of "C++0x"
David Blaikie [Tue, 18 Oct 2011 05:49:30 +0000 (05:49 +0000)]
Update documentation to use "C++11" instead of "C++0x"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142339 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't format the code completion for parameters of block literal
Douglas Gregor [Tue, 18 Oct 2011 04:23:19 +0000 (04:23 +0000)]
Don't format the code completion for parameters of block literal
arguments as block literal arguments; the block literal argument code
completion should only go one level deep. Fixes <rdar://problem/10291294>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142335 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd -Wc++11-compat warning for an inline specifier on an explicit instantiation.
Richard Smith [Tue, 18 Oct 2011 03:44:03 +0000 (03:44 +0000)]
Add -Wc++11-compat warning for an inline specifier on an explicit instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142333 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen transforming the arguments for a C++ "new" expression, make sure
Douglas Gregor [Tue, 18 Oct 2011 02:43:19 +0000 (02:43 +0000)]
When transforming the arguments for a C++ "new" expression, make sure
to drop the implicitly-generated value initialization expression used
for initializing scalars. Fixes <rdar://problem/10283928>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142330 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor the checking for explicit template instantiations being performed in
Richard Smith [Tue, 18 Oct 2011 02:28:33 +0000 (02:28 +0000)]
Refactor the checking for explicit template instantiations being performed in
the right namespace in C++11 mode. Teach the code to prefer the 'must be in
precisely this namespace' diagnostic whenever that's true, and fix a defect
which resulted in the -Wc++11-compat warning in C++98 mode sometimes being
omitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142329 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoArgyrios says this change is required for safety under PTH.
John McCall [Tue, 18 Oct 2011 01:36:41 +0000 (01:36 +0000)]
Argyrios says this change is required for safety under PTH.
Me, I believe him.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142327 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert accidental commit.
Eli Friedman [Tue, 18 Oct 2011 01:18:41 +0000 (01:18 +0000)]
Revert accidental commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142326 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRewrite parts of MS ABI C++ layout. Based on work by r4start; I ended up doing this...
Eli Friedman [Tue, 18 Oct 2011 00:55:28 +0000 (00:55 +0000)]
Rewrite parts of MS ABI C++ layout.  Based on work by r4start; I ended up doing this while I was trying to review his patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142325 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix several bugs with #pragma clang arc_cf_code_audited and macros.
John McCall [Tue, 18 Oct 2011 00:44:04 +0000 (00:44 +0000)]
Fix several bugs with #pragma clang arc_cf_code_audited and macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142324 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r142311, -mios-simulator-version-min does not work correctly.
Argyrios Kyrtzidis [Tue, 18 Oct 2011 00:22:49 +0000 (00:22 +0000)]
Revert r142311, -mios-simulator-version-min does not work correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142322 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIn hasPlaceholderType(Kind) and isSpecificPlaceholderType(Kind), assert
John McCall [Mon, 17 Oct 2011 23:48:15 +0000 (23:48 +0000)]
In hasPlaceholderType(Kind) and isSpecificPlaceholderType(Kind), assert
that the parameter is actually a placeholder type kind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142312 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the hack where we sniff the __IPHONE_OS_VERSION_MIN_REQUIRED define.
Argyrios Kyrtzidis [Mon, 17 Oct 2011 23:41:26 +0000 (23:41 +0000)]
Remove the hack where we sniff the __IPHONE_OS_VERSION_MIN_REQUIRED define.

We can use -mios-simulator-version-min now. rdar://10218700

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142311 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPerform lvalue-to-rvalue conversions on __builtin_offsetof array argument index
Richard Smith [Mon, 17 Oct 2011 23:29:39 +0000 (23:29 +0000)]
Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument index
before typechecking, as suggested by John.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142308 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[arcmt] In ARC default for properties is 'strong' so just remove a 'retain' if possible,
Argyrios Kyrtzidis [Mon, 17 Oct 2011 23:14:16 +0000 (23:14 +0000)]
[arcmt] In ARC default for properties is 'strong' so just remove a 'retain' if possible,
instead of changing it to 'strong'. rdar://9984862.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142304 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
Richard Smith [Mon, 17 Oct 2011 23:06:20 +0000 (23:06 +0000)]
Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142302 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWire up support for the controlling the extended dwarf .file directive. With
Nick Lewycky [Mon, 17 Oct 2011 23:05:52 +0000 (23:05 +0000)]
Wire up support for the controlling the extended dwarf .file directive. With
r142300 but not this patch, clang -S may emit .s files that assemblers other
than llvm-mc can't parse.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142301 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSilence a -Wc++0x-narrowing warning
Matt Beaumont-Gay [Mon, 17 Oct 2011 22:19:09 +0000 (22:19 +0000)]
Silence a -Wc++0x-narrowing warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement -static-libstdc++ for linux.
Rafael Espindola [Mon, 17 Oct 2011 22:14:51 +0000 (22:14 +0000)]
Implement -static-libstdc++ for linux.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142290 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTry fixing MSVC compiler errors.
Argyrios Kyrtzidis [Mon, 17 Oct 2011 22:12:24 +0000 (22:12 +0000)]
Try fixing MSVC compiler errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142289 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd missing newline.
Eli Friedman [Mon, 17 Oct 2011 21:48:31 +0000 (21:48 +0000)]
Add missing newline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142285 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove about 20 random diagnostics under -W flags. Patch by Ahmed Charles!
Ted Kremenek [Mon, 17 Oct 2011 21:47:53 +0000 (21:47 +0000)]
Move about 20 random diagnostics under -W flags.  Patch by Ahmed Charles!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142284 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInitial implementation of __atomic_is_lock_free. The input is the size of an atomic...
Eli Friedman [Mon, 17 Oct 2011 21:44:23 +0000 (21:44 +0000)]
Initial implementation of __atomic_is_lock_free.  The input is the size of an atomic type rather than an atomic type itself just to save some implementation pain; I can change that if it seems worthwhile.

I think this is the last hook needed for <atomic> besides defines for ATOMIC_CHAR_LOCK_FREE and friends.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142281 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement -static-libgcc on linux and refactor the code responsible for adding
Rafael Espindola [Mon, 17 Oct 2011 21:39:04 +0000 (21:39 +0000)]
Implement -static-libgcc on linux and refactor the code responsible for adding
libgcc to the link line into a helper function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142269 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSubstitute for arguments in method calls -- functionality
DeLesley Hutchins [Mon, 17 Oct 2011 21:38:02 +0000 (21:38 +0000)]
Substitute for arguments in method calls -- functionality

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142267 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSubstitute for arguments in method calls -- refactoring
DeLesley Hutchins [Mon, 17 Oct 2011 21:33:35 +0000 (21:33 +0000)]
Substitute for arguments in method calls -- refactoring

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142260 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor __attribute__ parsing, and add a diagnostic if the r_paren at the end
Richard Smith [Mon, 17 Oct 2011 21:20:17 +0000 (21:20 +0000)]
Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the end
of an attrib is missing. gcc does not allow the closing parenthesis to be omitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCode completion chunks are pod-like.
Benjamin Kramer [Mon, 17 Oct 2011 21:17:53 +0000 (21:17 +0000)]
Code completion chunks are pod-like.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142252 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThe comparison of two vectors should return a signed result. hasIntegerRepresentation...
Tanya Lattner [Mon, 17 Oct 2011 21:00:38 +0000 (21:00 +0000)]
The comparison of two vectors should return a signed result. hasIntegerRepresentation() used to always return false for vectors, but since it was changed, it also
changed the return type of a compare of two unsigned vectors to be unsigned. This patch removes the check for hasIntegerRepresentation since its not needed and returns the appropriate signed type.
I added a new test case and updated exisiting test cases that assumed an unsigned result.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142250 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobj-c++: Fix a IRGen crash when getter is a reference type.
Fariborz Jahanian [Mon, 17 Oct 2011 21:00:22 +0000 (21:00 +0000)]
obj-c++: Fix a IRGen crash when getter is a reference type.
Fix is in Sema. // rdar://10153365

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142249 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd missing case to switch.
Eli Friedman [Mon, 17 Oct 2011 20:46:28 +0000 (20:46 +0000)]
Add missing case to switch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142246 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoStrip qualifiers off the type of an implicit property defined by
John McCall [Mon, 17 Oct 2011 20:05:43 +0000 (20:05 +0000)]
Strip qualifiers off the type of an implicit property defined by
only a setter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142236 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Introduce a new high level API for indexing clients that assumes
Argyrios Kyrtzidis [Mon, 17 Oct 2011 19:48:19 +0000 (19:48 +0000)]
[libclang] Introduce a new high level API for indexing clients that assumes
more of the work involved in indexing a translation unit and simplifies client
implementations.

Only C/ObjC for now, C++ (and comments) to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142233 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduce ASTConsumer::HandleTopLevelDeclInObjCContainer which accepts
Argyrios Kyrtzidis [Mon, 17 Oct 2011 19:48:13 +0000 (19:48 +0000)]
Introduce ASTConsumer::HandleTopLevelDeclInObjCContainer which accepts
top-level declarations that occurred inside an ObjC container.

This is useful to keep track of such decls otherwise when e.g. a function
is declared inside an objc interface, it is not passed to HandleTopLevelDecl
and it is not inside the DeclContext of the interface that is returned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142232 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHave ObjCMethodDecl::getCanonicalDecl take into account redeclared methods.
Argyrios Kyrtzidis [Mon, 17 Oct 2011 19:48:09 +0000 (19:48 +0000)]
Have ObjCMethodDecl::getCanonicalDecl take into account redeclared methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142231 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoKeep track when a ObjC interface/protocol was initially created as a forward reference.
Argyrios Kyrtzidis [Mon, 17 Oct 2011 19:48:06 +0000 (19:48 +0000)]
Keep track when a ObjC interface/protocol was initially created as a forward reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142230 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoControlling macros are identifiers, not declarations.
Douglas Gregor [Mon, 17 Oct 2011 18:53:12 +0000 (18:53 +0000)]
Controlling macros are identifiers, not declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142225 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTeach the ARC compiler to not require __bridge casts when
John McCall [Mon, 17 Oct 2011 18:40:02 +0000 (18:40 +0000)]
Teach the ARC compiler to not require __bridge casts when
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142219 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a new placeholder type to represent "unbridged"
John McCall [Mon, 17 Oct 2011 18:09:15 +0000 (18:09 +0000)]
Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142208 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a helper function for determining whether an expression
John McCall [Mon, 17 Oct 2011 17:42:19 +0000 (17:42 +0000)]
Add a helper function for determining whether an expression
has placeholder type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142203 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen we end up having to parse the initializer of a C++ member early
Douglas Gregor [Mon, 17 Oct 2011 17:09:53 +0000 (17:09 +0000)]
When we end up having to parse the initializer of a C++ member early
in -fms-extensions mode, make sure we actually use that initializer
after having handled the declaration. Fixes PR11150.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142195 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r142142: "Make a C-style cast a const-cast, to suppress a GCC warning."
Sebastian Redl [Mon, 17 Oct 2011 16:53:50 +0000 (16:53 +0000)]
Revert r142142: "Make a C-style cast a const-cast, to suppress a GCC warning."
Richard already fixed the underlying issue, so the cast was superfluous.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142192 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFor modules, all macros that aren't include guards are implicitly
Douglas Gregor [Mon, 17 Oct 2011 15:32:29 +0000 (15:32 +0000)]
For modules, all macros that aren't include guards are implicitly
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142188 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen building a module, use the macro definitions on the command line
Douglas Gregor [Mon, 17 Oct 2011 14:55:37 +0000 (14:55 +0000)]
When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142187 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFixed merge-mistake where ActOnAccessSpecifier was called twice for every access...
Erik Verbruggen [Mon, 17 Oct 2011 09:54:52 +0000 (09:54 +0000)]
Fixed merge-mistake where ActOnAccessSpecifier was called twice for every access specifier. The testcase has been changed to catch this too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142186 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPerform an lvalue-to-rvalue conversion on an array index in a __builtin_offsetof...
Richard Smith [Mon, 17 Oct 2011 05:48:07 +0000 (05:48 +0000)]
Perform an lvalue-to-rvalue conversion on an array index in a __builtin_offsetof expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142179 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSlightly simplify a constant expression check. No functional change.
Richard Smith [Sun, 16 Oct 2011 23:01:09 +0000 (23:01 +0000)]
Slightly simplify a constant expression check. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142167 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a testcase for r142121 based on an idea from Richard Smith. Thanks!
Chandler Carruth [Sun, 16 Oct 2011 21:33:06 +0000 (21:33 +0000)]
Add a testcase for r142121 based on an idea from Richard Smith. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142160 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSplit apart the state accumulated during constant expression evaluation and the
Richard Smith [Sun, 16 Oct 2011 21:26:27 +0000 (21:26 +0000)]
Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142159 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd sema checks for calls to functions taking static array parameters
Peter Collingbourne [Sun, 16 Oct 2011 21:17:32 +0000 (21:17 +0000)]
Add sema checks for calls to functions taking static array parameters

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142157 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement overload resolution from init lists for scalar parameter types.
Sebastian Redl [Sun, 16 Oct 2011 18:19:34 +0000 (18:19 +0000)]
Implement overload resolution from init lists for scalar parameter types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142148 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDiagnose when omitting braces in direct list-initialization in C++0x.
Sebastian Redl [Sun, 16 Oct 2011 18:19:28 +0000 (18:19 +0000)]
Diagnose when omitting braces in direct list-initialization in C++0x.

This also applies to C99-style aggregate literals, should they be used in C++11, since they are effectively identical to constructor call list-initialization syntax.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142147 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIn the verify-only pass, check that items that don't have an initializer in an init...
Sebastian Redl [Sun, 16 Oct 2011 18:19:20 +0000 (18:19 +0000)]
In the verify-only pass, check that items that don't have an initializer in an init list can be value-initialized, at least when designated initializers are not involved. No test case yet, since early failures cannot be distinguished from late failures until overload resolution works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142146 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCheck for unavailable declarations in Sema::CanUseDecl.
Sebastian Redl [Sun, 16 Oct 2011 18:19:16 +0000 (18:19 +0000)]
Check for unavailable declarations in Sema::CanUseDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142145 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoProve that non-overloaded function calls using init list arguments work.
Sebastian Redl [Sun, 16 Oct 2011 18:19:11 +0000 (18:19 +0000)]
Prove that non-overloaded function calls using init list arguments work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142144 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDrop the Diagnose parameter from Sema::PerformImplicitConversion again and instead...
Sebastian Redl [Sun, 16 Oct 2011 18:19:06 +0000 (18:19 +0000)]
Drop the Diagnose parameter from Sema::PerformImplicitConversion again and instead use TryImplicitConversion in CheckSingleAssignmentConstraints when that function is in no-diagnostics mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142143 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake a C-style cast a const-cast, to suppress a GCC warning. I should fix the underly...
Sebastian Redl [Sun, 16 Oct 2011 18:18:59 +0000 (18:18 +0000)]
Make a C-style cast a const-cast, to suppress a GCC warning. I should fix the underlying issue eventually, but this interface will probably change anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142142 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the leftover partial comment.
David Blaikie [Sun, 16 Oct 2011 14:41:13 +0000 (14:41 +0000)]
Remove the leftover partial comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142138 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a silly bug introduced in r142133.
Chandler Carruth [Sun, 16 Oct 2011 11:05:04 +0000 (11:05 +0000)]
Fix a silly bug introduced in r142133.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142134 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoClean up some cruft in the library path searching logic by making
Chandler Carruth [Sun, 16 Oct 2011 10:54:30 +0000 (10:54 +0000)]
Clean up some cruft in the library path searching logic by making
'libdir' mean the actual library directory, not the GCC subdirectory of
the library directory. That was just a confusing pattern. Instead,
supply proper GCC subdirectories when scanning for various triple-based
subdirectories with a GCC installation in them. This also makes it much
more obvious how multiarch installations, which have a triple-based
prefix as well as suffix work.

Also clean up our handling of these triple-prefixed trees by using them
in both a multiarch pattern and a non-multiarch pattern whenever they
exist.

Note that this *does not* match what GCC does on Debian, the only truly
multiarch installation I've been able to get installed and test on. GCC
appears to have a bug, and ends up searching paths like
'/lib/../../lib32' which makes no sense what-so-ever. Instead, I've
tried to encode the rational logic that seems clearly intended by GCC's
pattern. GCC ends up with patterns like:

  /lib/../../lib32
  /usr/lib/../../lib32
  /usr/lib/x86_64-linux-gnu/../..lib32

Only the last one makes any sense having a '/../..' in it, so in Clang,
that's the only one which gets a '/../..' in it.

I *think* this will fix Debian multiarch links. I'm committing without
baking this logic into our test suite so I can test on a few different
systems. If all goes well (and no one screams) I'll check in some more
comprehensive tests for multiarch behavior tomorrow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142133 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoConvert inline asm source ranges into clang SourceRanges and print them with the...
Benjamin Kramer [Sun, 16 Oct 2011 10:48:28 +0000 (10:48 +0000)]
Convert inline asm source ranges into clang SourceRanges and print them with the instantiated note.

t.c:2:7: error: invalid operand for instruction
  asm("movl 0(%rax), 0(%edx)");
      ^
<inline asm>:1:16: note: instantiated into assembly here
        movl 0(%rax), 0(%edx)
                      ^~~~~~~
1 error generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142131 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoI fixed this with r142127; these notes now make sense even w/o the caret.
Chandler Carruth [Sun, 16 Oct 2011 09:41:04 +0000 (09:41 +0000)]
I fixed this with r142127; these notes now make sense even w/o the caret.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142129 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHoist the logic I added to compute the macro name into a helper
Chandler Carruth [Sun, 16 Oct 2011 09:39:09 +0000 (09:39 +0000)]
Hoist the logic I added to compute the macro name into a helper
function. No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142128 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNow that macro expansion notes are real notes and go through the same
Chandler Carruth [Sun, 16 Oct 2011 09:30:08 +0000 (09:30 +0000)]
Now that macro expansion notes are real notes and go through the same
formatting as any other diagnostic, they will be properly line wrapped and
otherwise pretty printed. Let's take advantage of that and the new factoring to
add some helpful information to them (much like template backtrace notes and
other notes): the name of the macro whose expansion is being noted. This makes
a world of difference if caret diagnostics are disabled, making the expansion
notes actually useful in this case. It also helps ensure that in edge cases the
information the user needs is present. Consider:

% nl -ba t5.cc
     1  #define M(x, y, z) \
     2    y
     3
     4  M(
     5    1,
     6    2,
     7    3);

We now produce:
% ./bin/clang -fsyntax-only t5.cc
t5.cc:6:3: error: expected unqualified-id
  2,
  ^
t5.cc:2:3: note: expanded from macro: M
  y
  ^
1 error generated.

Without the added information in the note, the name of the macro being expanded
would never be shown.

This also deletes a FIXME to use the diagnostic formatting. It's not yet clear
to me that we *can* do this reasonably, and the production of this message was
my primary goal here anyways.

I'd love any comments or suggestions on improving these notes, their wording,
etc. Currently, I need to make them provide more helpful information in the
presence of a token-pasting buffer, and I'm pondering adding something along
the lines of "expanded from argument N of macro: ...".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142127 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the original bug in our diagnostic printing that got me started on
Chandler Carruth [Sun, 16 Oct 2011 07:36:11 +0000 (07:36 +0000)]
Fix the original bug in our diagnostic printing that got me started on
this long quest: actually use the note printing machinery for each macro
expansion note rather than a hacky version of it. This will colorize and
format the notes the same as any other. There is still some stuff to fix
here, but it's one step closer.

No test case changes because currently we don't do anything differently
that I can FileCheck for -- I don't really want to try matching the
color escape codes... Suggestions for how to test this are welcome. =]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142121 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNow that the structure of this is more reasonably laid out, fix a long
Chandler Carruth [Sun, 16 Oct 2011 07:20:28 +0000 (07:20 +0000)]
Now that the structure of this is more reasonably laid out, fix a long
standing deficiency: we were providing no macro backtrace information
whenever caret diagnostics were turned off. This sinks the logic for
suppressing the code snippet and caret to the code that actually prints
tho code snippet and caret. Along the way, clean up the naming of
functions, remove some now fixed FIXMEs, and generally improve the
wording and logic of this process.

Add a test case exerecising this functionality. It is notable that the
resulting messages are extremely low quality. I'm working on a follow-up
patch that should address this and have left a FIXME in the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142120 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a prefix to the existing test to prepare for more tests of other
Chandler Carruth [Sun, 16 Oct 2011 07:20:23 +0000 (07:20 +0000)]
Add a prefix to the existing test to prepare for more tests of other
backtrace behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142119 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFold two run lines into a single logical one, and move them down below
Chandler Carruth [Sun, 16 Oct 2011 07:20:21 +0000 (07:20 +0000)]
Fold two run lines into a single logical one, and move them down below
the important code in this test to make the test more stable. Now adding
further tests won't shift the line numbers occuring in the diagnostic
output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142118 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRename this test to a more general name in preparation for adding more
Chandler Carruth [Sun, 16 Oct 2011 06:55:30 +0000 (06:55 +0000)]
Rename this test to a more general name in preparation for adding more
tests to it to cover more of the macro bactrace functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142116 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEnable CREATE_SUBDIRS for a performance win, because there are a lot of files being...
Bill Wendling [Sun, 16 Oct 2011 06:43:18 +0000 (06:43 +0000)]
Enable CREATE_SUBDIRS for a performance win, because there are a lot of files being generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142113 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd proper doxyments to the entry point routine, and remove a dead parameter.
Chandler Carruth [Sun, 16 Oct 2011 06:24:58 +0000 (06:24 +0000)]
Add proper doxyments to the entry point routine, and remove a dead parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142109 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPersist the TextDiagnostic object across multiple diagnostics as long as
Chandler Carruth [Sun, 16 Oct 2011 02:57:39 +0000 (02:57 +0000)]
Persist the TextDiagnostic object across multiple diagnostics as long as
the SourceManager doesn't change, and the source files don't change.
This greatly simplifies the interfaces and interactions. The lifetime of
the TextDiagnostic object forms the 'session' over which we attempt to
condense and deduplicate information in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142104 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoClean up the names of all the TextDiagnostic methods (and even a static
Chandler Carruth [Sat, 15 Oct 2011 23:54:09 +0000 (23:54 +0000)]
Clean up the names of all the TextDiagnostic methods (and even a static
function) to agree with the coding conventions, and in one case have
a bit more information in it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142088 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove two functions out of the public interface that shouldn't have ever
Chandler Carruth [Sat, 15 Oct 2011 23:48:02 +0000 (23:48 +0000)]
Move two functions out of the public interface that shouldn't have ever
been there. Also delete their redundant doxyments in favor of those in
the source file. I'm putting the doxyments for private and static
helpers into the implementation file, and only the public interface
doxyments into the header. If folks have strong opinions about this type
of split, feel free to chime in, I'm happy to re-organize.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142087 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoGraduate the TextDiagnostic interface to its own header and source file,
Chandler Carruth [Sat, 15 Oct 2011 23:43:53 +0000 (23:43 +0000)]
Graduate the TextDiagnostic interface to its own header and source file,
making it accessible to anyone from the Frontend library. Still a good
bit of cleanup to do here, but its a good milestone. This ensures that
*all* of the functionality needed to implement the DiagnosticConsumer is
exposed via the generic interface in some form. No sneaky re-use of
static functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142086 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove the message printing to a class-static function so that it can be
Chandler Carruth [Sat, 15 Oct 2011 22:57:29 +0000 (22:57 +0000)]
Move the message printing to a class-static function so that it can be
part of the TextDiagnostic interface without requiring a full instance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142085 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove the diagnostic level printing into a class static helper. This will
Chandler Carruth [Sat, 15 Oct 2011 22:49:21 +0000 (22:49 +0000)]
Move the diagnostic level printing into a class static helper. This will
allow the TextDiagnosticPrinter to continue using it even if
TextDiagnostic is implemented in a separate file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142084 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRationalize the last bit of "arbitrary" state that is carried between
Chandler Carruth [Sat, 15 Oct 2011 22:39:16 +0000 (22:39 +0000)]
Rationalize the last bit of "arbitrary" state that is carried between
diagnostics to control suppression of redundant information. It now
follows the same model as all the other state, and has a bit more clear
semantics.

This is making the duality of the state a bit annoying, and I've added
a FIXME to resolve it. The problem is that I need to lift the
TextDiagnostic up into an externally visible layer before that can
happen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142083 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAvoid duplicate unavailbility diagnostics in objc++.
Fariborz Jahanian [Sat, 15 Oct 2011 19:18:36 +0000 (19:18 +0000)]
Avoid duplicate unavailbility diagnostics in objc++.
// rdar://10268422

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142078 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPlace static initializers on linux into the ".text.startup" section, so the linker...
Benjamin Kramer [Sat, 15 Oct 2011 17:53:33 +0000 (17:53 +0000)]
Place static initializers on linux into the ".text.startup" section, so the linker can group them together for performance.

This only has an effect with fairly new binutils (2.21.51 or later). Other ELF targets probably want this as well, but on BSDs binutils is usually old so it doesn't matter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142076 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobj-c++: allow the getter/setter to return/take parameters
Fariborz Jahanian [Sat, 15 Oct 2011 17:36:49 +0000 (17:36 +0000)]
obj-c++: allow the getter/setter to return/take parameters
by reference. // rdar://10188258

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142075 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInternals manual: eliminate mention of System library
Peter Collingbourne [Sat, 15 Oct 2011 16:59:24 +0000 (16:59 +0000)]
Internals manual: eliminate mention of System library

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142074 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace vectors with arrays.
Benjamin Kramer [Sat, 15 Oct 2011 12:20:02 +0000 (12:20 +0000)]
Replace vectors with arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142072 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNeither 'Warning' nor 'NonNote' was a good name for this location...
Chandler Carruth [Sat, 15 Oct 2011 12:12:44 +0000 (12:12 +0000)]
Neither 'Warning' nor 'NonNote' was a good name for this location...
It's the last include-stack-root we tried to walk up. Use a better name
and better doxyments for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142071 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNuke a bunch of FIXMEs that are now fixed. =] Also, remove the now-dead
Chandler Carruth [Sat, 15 Oct 2011 12:07:49 +0000 (12:07 +0000)]
Nuke a bunch of FIXMEs that are now fixed. =] Also, remove the now-dead
TextDiagnosticPrinter argument to the TextDiagnostic helper class. This
cements the proper ordering of things: TextDiagnostic is now a viable
stand-alone class for emitting pretty-printed textual diagnostics to
a terminal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142070 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSink the include stack printing into the generic text diagnostic
Chandler Carruth [Sat, 15 Oct 2011 12:07:47 +0000 (12:07 +0000)]
Sink the include stack printing into the generic text diagnostic
utility. This is a particularly nice win because it removes a pile of
parameters from these routines. Also name them a bit better. I'm trying
to follow the pattern of 'emit' routines writing directly to what is
expected to be the final output, while 'print' routines take a output
stream argument and can be used to build up intermediate buffers, etc.

Also, fix a bug I spotted by inspection from my last commit where
'LastLoc' and 'LastNonNoteLoc' were reversed. It's really scary that
this didn't trigger a single test failure. Will be working on tests for
more of this functionality now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142069 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRationalize some of how the locations of prior diagnostics are tracked
Chandler Carruth [Sat, 15 Oct 2011 11:44:27 +0000 (11:44 +0000)]
Rationalize some of how the locations of prior diagnostics are tracked
across emissions.

1) The include stack printing is conditioned on non-note diagnostics,
   not just on warning diagnostics.
2) Those should be full source locations as they're tied to a source
   manager.
3) We should pass in the prior state to the TextDiagnostic constructor,
   allow it to mutate as diagnostics are emitted, and then cache the
   final state before tearing it down.

Some of this remains incomplete, specifically #3 isn't finished for the
non-note location. That'll come when the include stack printing sinks
down a level.

This also highlights how *completely* bug-ridden this code is. For
example, we currently do all these comparisons of a FullSourceLoc and
a SourceLocation... which silently does a SourceLocation to
SourceLocation comparison, completely disregarding the source manager
from whence one of the arguments came. Oops! Good thing in practice this
wasn't important, but it could in theory be suppressing caret
diagnostics in a second TU on a single clang invocation. I'm hoping to
hammer these bugs out as the refactorings occur, although for so many of
them it's really unlikely I can dream up a test case that would show the
potentially buggy behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142067 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSink the EmitDiagnosticLoc method down to the generic TextDiagnostic
Chandler Carruth [Sat, 15 Oct 2011 11:09:23 +0000 (11:09 +0000)]
Sink the EmitDiagnosticLoc method down to the generic TextDiagnostic
interface now that its only caller is there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142065 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSink the non-caret diagnostic logic down and out of the diagnostic
Chandler Carruth [Sat, 15 Oct 2011 11:09:19 +0000 (11:09 +0000)]
Sink the non-caret diagnostic logic down and out of the diagnostic
consumer. The TextDiagnostic interface now has a generic entry point for
emitting a diagnostic which uses a minimal interface that should be
compatible with StoredDiagnostics such as are available in libclang etc.

Some unfortunate shuffling of static functions as things get relocated.
Also some unfortunate public interface points added to
TextDiagnosticPrinter, but those are the next bits to get moved so they
won't last long.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142064 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplify the interface of a helper method in the TextDiagnosticPrinter
Chandler Carruth [Sat, 15 Oct 2011 10:48:19 +0000 (10:48 +0000)]
Simplify the interface of a helper method in the TextDiagnosticPrinter
to operate directly on the source location and ranges associated with
a diagnostic rather than digging them out of the diagnostic. This had
a side benefit of cleaning up its code a tiny bit by using the ArrayRef
interface.

No functionality changed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142063 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd an accessor for all of the ranges in a diagnostic as an ArrayRef.
Chandler Carruth [Sat, 15 Oct 2011 10:48:13 +0000 (10:48 +0000)]
Add an accessor for all of the ranges in a diagnostic as an ArrayRef.
This will simplify a number of calls in the diagnostic printing going
forward.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142062 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd -Wc++98-compat warning for deduced 'auto' type specifier.
Richard Smith [Sat, 15 Oct 2011 05:42:01 +0000 (05:42 +0000)]
Add -Wc++98-compat warning for deduced 'auto' type specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142057 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement -Wc++98-compat warnings for the parser.
Richard Smith [Sat, 15 Oct 2011 05:09:34 +0000 (05:09 +0000)]
Implement -Wc++98-compat warnings for the parser.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142056 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor: remove redundant check for 'final' specifier when parsing class/struct...
Richard Smith [Sat, 15 Oct 2011 04:21:46 +0000 (04:21 +0000)]
Refactor: remove redundant check for 'final' specifier when parsing class/struct definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142054 91177308-0d34-0410-b5e6-96231b3b80d8