]> granicus.if.org Git - clang/log
clang
12 years agoSuggest adding 'typename' when it would make the compiler
Kaelyn Uhrain [Fri, 18 May 2012 23:42:49 +0000 (23:42 +0000)]
Suggest adding 'typename' when it would make the compiler
accept the template argument expression as a type.

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

12 years ago[analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr)
Anna Zaks [Fri, 18 May 2012 22:47:43 +0000 (22:47 +0000)]
[analyzer] Fix a c++11 crash: xvalues can be locations (VisitMemberExpr)

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

12 years ago[analyzer] Malloc checker: remove unnecessary comparisons.
Anna Zaks [Fri, 18 May 2012 22:47:40 +0000 (22:47 +0000)]
[analyzer] Malloc checker: remove unnecessary comparisons.

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

12 years agoobjc: use "class extension" instead of "continuation class"
Fariborz Jahanian [Fri, 18 May 2012 21:22:49 +0000 (21:22 +0000)]
objc: use "class extension" instead of "continuation class"
to match documentation. // rdar://11309706

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

12 years agoLexer::ReadToEndOfLine: Only build the string if it's actually used and do so in...
Benjamin Kramer [Fri, 18 May 2012 19:32:16 +0000 (19:32 +0000)]
Lexer::ReadToEndOfLine: Only build the string if it's actually used and do so in a less malloc-intensive way.

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

12 years agoTypo.
Chad Rosier [Fri, 18 May 2012 16:56:52 +0000 (16:56 +0000)]
Typo.

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

12 years agoCentralize the handling of the "attribute declaration must precede definition"
Rafael Espindola [Fri, 18 May 2012 01:47:00 +0000 (01:47 +0000)]
Centralize the handling of the "attribute declaration must precede definition"
warning. This also makes us warn on tags, which, ironically, is the only case
gcc warns on.

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

12 years ago[analyzer]Malloc: refactor and report use after free by memory
Anna Zaks [Fri, 18 May 2012 01:16:10 +0000 (01:16 +0000)]
[analyzer]Malloc: refactor and report use after free by memory
allocating functions.

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

12 years agoAnother test for r157025 <rdar://problem/11460990>.
Fariborz Jahanian [Fri, 18 May 2012 00:19:25 +0000 (00:19 +0000)]
Another test for r157025  <rdar://problem/11460990>.

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

12 years agoA selector match between two Objective-C methods does *not* guarantee
Douglas Gregor [Thu, 17 May 2012 23:13:29 +0000 (23:13 +0000)]
A selector match between two Objective-C methods does *not* guarantee
that the methods have the same number of parameters, although we
certainly assumed this in many places. Objective-C can be insane
sometimes. Fixes <rdar://problem/11460990>.

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

12 years agoRemove trailing periods which snuck into a few diagnostic strings.
Matt Beaumont-Gay [Thu, 17 May 2012 22:46:56 +0000 (22:46 +0000)]
Remove trailing periods which snuck into a few diagnostic strings.

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

12 years agoIn the override search for Objective-C methods, protect against ASTs that have NULL...
Douglas Gregor [Thu, 17 May 2012 22:39:14 +0000 (22:39 +0000)]
In the override search for Objective-C methods, protect against ASTs that have NULL interfaces behind a category, which can happen in invalid code. Fixes <rdar://problem/11478173>, a recent regression

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

12 years agoDrop the question mark when complaining about a non-existing -Wno- flag.
Benjamin Kramer [Thu, 17 May 2012 21:14:26 +0000 (21:14 +0000)]
Drop the question mark when complaining about a non-existing -Wno- flag.

We're certain that it doesn't exist.

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

12 years agoAdd -mno-implicit-float to the M group.
Chad Rosier [Thu, 17 May 2012 20:53:37 +0000 (20:53 +0000)]
Add -mno-implicit-float to the M group.

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

12 years ago[arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
Argyrios Kyrtzidis [Thu, 17 May 2012 18:16:05 +0000 (18:16 +0000)]
[arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
migration error.

This is more trouble that it is worth; autoreleasing a value without holding on it
is a valid use-case, we should not "punish" correct code for the minority of
broken/fragile programs that depend on the behavior of  -autorelease.

rdar://9914061

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

12 years ago[driver] Reword the warning message for missing value to a joined argument.
Chad Rosier [Thu, 17 May 2012 15:45:13 +0000 (15:45 +0000)]
[driver] Reword the warning message for missing value to a joined argument.

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

12 years agoAdded two missing const qualifiers.
Abramo Bagnara [Thu, 17 May 2012 12:44:05 +0000 (12:44 +0000)]
Added two missing const qualifiers.

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

12 years agoCXXThisScopeRAII objects aren't free, don't compute one if it's unused.
Benjamin Kramer [Thu, 17 May 2012 12:01:52 +0000 (12:01 +0000)]
CXXThisScopeRAII objects aren't free, don't compute one if it's unused.

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

12 years ago[tsan] grammar fixes
Kostya Serebryany [Thu, 17 May 2012 08:49:14 +0000 (08:49 +0000)]
[tsan] grammar fixes

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

12 years agoUse the argument location instead of the format string location when warning
Matt Beaumont-Gay [Thu, 17 May 2012 00:03:16 +0000 (00:03 +0000)]
Use the argument location instead of the format string location when warning
about argument type mismatch.

This gives a nicer diagnostic in cases like
  printf(fmt,
         i);
where previously the snippet just pointed at 'fmt' (with a note at the
definition of fmt).

It's a wash for cases like
  printf("%f",
         i);
where previously we snippeted the offending portion of the format string,
but didn't indicate which argument was at fault.

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

12 years ago[libclang/AST] When declaring a local class, don't neglect to set the end location
Argyrios Kyrtzidis [Wed, 16 May 2012 23:49:15 +0000 (23:49 +0000)]
[libclang/AST] When declaring a local class, don't neglect to set the end location
of the DeclStmt node, otherwise libclang will not work for anything inside that
class.

rdar://10837710

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

12 years ago[driver] Remove obsolete support for -A link option. The standard -A option is
Chad Rosier [Wed, 16 May 2012 23:45:12 +0000 (23:45 +0000)]
[driver] Remove obsolete support for -A link option.  The standard -A option is
used by the preprocessor.  Apple's GCC also supported a -A option for linking.

The ld man page has the following:
 -A basefile - Obsolete incremental load format.  This option is obsolete.

Nick Kledzik confirms this option is no longer needed/supported.
rdar://11455614

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

12 years agoRecover better from a missing 'typename' in a function template definition.
Richard Smith [Wed, 16 May 2012 23:40:17 +0000 (23:40 +0000)]
Recover better from a missing 'typename' in a function template definition.
Disambiguate past such a potential problem, and use the absence of 'typename'
to break ties in favor of a parenthesized thingy being an initializer, if
nothing else in the declaration disambiguates it as declaring a function.

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

12 years agoSmallString Visual Studio visualizer by Will Wilson.
David Blaikie [Wed, 16 May 2012 22:28:47 +0000 (22:28 +0000)]
SmallString Visual Studio visualizer by Will Wilson.

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

12 years agoclang/test/Tooling: Remark as XFAIL again in 5 tests for msvc hosts.
NAKAMURA Takumi [Wed, 16 May 2012 22:14:14 +0000 (22:14 +0000)]
clang/test/Tooling: Remark as XFAIL again in 5 tests for msvc hosts.

FIXME: JSON doesn't like path separator '\', on Win32 hosts.

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

12 years agoXFAIL this test on MIPS.
Akira Hatanaka [Wed, 16 May 2012 22:06:47 +0000 (22:06 +0000)]
XFAIL this test on MIPS.
Since r156650, clang has stopped emitting byval arguments for MIPS targets.

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

12 years agoRemove unnecessary temporary.
Eric Christopher [Wed, 16 May 2012 22:02:36 +0000 (22:02 +0000)]
Remove unnecessary temporary.

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

12 years agoRename the driver option to -mno-implicit-float, per Eli's suggestion.
Chad Rosier [Wed, 16 May 2012 21:19:55 +0000 (21:19 +0000)]
Rename the driver option to -mno-implicit-float, per Eli's suggestion.

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

12 years agoAdd triples for test.
Jordy Rose [Wed, 16 May 2012 21:13:36 +0000 (21:13 +0000)]
Add triples for test.

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

12 years agoPulls diagnostics for temp file handling into the common diagnostic kinds.
Manuel Klimek [Wed, 16 May 2012 20:55:58 +0000 (20:55 +0000)]
Pulls diagnostics for temp file handling into the common diagnostic kinds.

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

12 years ago[driver] Allow the driver to directly accept the -no-implicit-float option, so that the
Chad Rosier [Wed, 16 May 2012 20:40:09 +0000 (20:40 +0000)]
[driver] Allow the driver to directly accept the -no-implicit-float option, so that the
generation of implicit floating point instructions can be disable for ARM.
rdar://11409142

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

12 years ago[analyzer] Fix test for PR12206, which was failing on i386.
Jordy Rose [Wed, 16 May 2012 20:29:44 +0000 (20:29 +0000)]
[analyzer] Fix test for PR12206, which was failing on i386.

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

12 years agoAdd _alignof and __builtin_alignof as aliases for __alignof in
Douglas Gregor [Wed, 16 May 2012 20:04:05 +0000 (20:04 +0000)]
Add _alignof and __builtin_alignof as aliases for __alignof in
Microsoft mode, from Will Wilson!

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

12 years agoTweek r156937 a bit so that the suggestions are correct.
Chad Rosier [Wed, 16 May 2012 19:42:03 +0000 (19:42 +0000)]
Tweek r156937 a bit so that the suggestions are correct.

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

12 years agoWarn about -Wno-foo where foo is an unknown warning option. This is helpful
Chad Rosier [Wed, 16 May 2012 19:28:02 +0000 (19:28 +0000)]
Warn about -Wno-foo where foo is an unknown warning option.  This is helpful
for subtle misspellings such as -Wno-unused-command-line-arguments instead of
-Wno-unused-command-line-argument.

Also fix the diagnostic messages to properly handle -Wno- options.  Previously,
the positive version was always emitted (i.e., -Wfoo was emitted for -Wno-foo).
rdar://11461500

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

12 years ago[libclang] Properly handle @encode() in RecursiveASTVisitor and traverse
Argyrios Kyrtzidis [Wed, 16 May 2012 19:22:47 +0000 (19:22 +0000)]
[libclang] Properly handle @encode() in RecursiveASTVisitor and traverse
its type source info. Fixes indexing references inside @encode().

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

12 years agoMove the warnings for extra semi-colons under -Wextra-semi. Also, added
Richard Trieu [Wed, 16 May 2012 19:04:59 +0000 (19:04 +0000)]
Move the warnings for extra semi-colons under -Wextra-semi.  Also, added
a warning for an extra semi-colon after function definitions.  Added logic
so that a block of semi-colons on a line will only get one warning instead
of a warning for each semi-colon.

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

12 years ago[analyzer] Revert a regression committed in r156920.
Anna Zaks [Wed, 16 May 2012 18:46:25 +0000 (18:46 +0000)]
[analyzer] Revert a regression committed in r156920.

This breaks the build with -triple i386-apple-darwin9.

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

12 years agoclang/test/Tooling: Remove XFAIL in 5 tests to unveil the real failure.
NAKAMURA Takumi [Wed, 16 May 2012 17:38:04 +0000 (17:38 +0000)]
clang/test/Tooling: Remove XFAIL in 5 tests to unveil the real failure.

FYI, they can pass on Cygwin w/o any tweaks.

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

12 years agoclang/test/Tooling/clang-check-pwd.cpp: Add "REQUIRES: shell".
NAKAMURA Takumi [Wed, 16 May 2012 17:37:56 +0000 (17:37 +0000)]
clang/test/Tooling/clang-check-pwd.cpp: Add "REQUIRES: shell".

This passes on MSYS bash and Cygwin.

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

12 years agoClean up r156925, so that we only mark the capturing DeclRefExpr of a
Douglas Gregor [Wed, 16 May 2012 17:01:33 +0000 (17:01 +0000)]
Clean up r156925, so that we only mark the capturing DeclRefExpr of a
lambda as referring to a local in an enclosing scope if we're in the
enclosing scope of the lambda (not it's function call operator). Also,
turn the test into an IR generation test, since that's where the
crashes occurred. Really fixes PR12746 / <rdar://problem/11465120>.

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

12 years agoFix code generation of variables reference expressions when mixing
Douglas Gregor [Wed, 16 May 2012 16:50:20 +0000 (16:50 +0000)]
Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.

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

12 years agoFix ASTReader handling of ImportDecls, from Meador Inge!
Douglas Gregor [Wed, 16 May 2012 16:31:58 +0000 (16:31 +0000)]
Fix ASTReader handling of ImportDecls, from Meador Inge!

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

12 years agoUse a llvm::SmallString rather than std::string for duplicate-case errors
Douglas Gregor [Wed, 16 May 2012 16:11:17 +0000 (16:11 +0000)]
Use a llvm::SmallString rather than std::string for duplicate-case errors

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

12 years ago[analyzer] Fix RUN lines for old XFAIL tests, one of which actually works.
Jordy Rose [Wed, 16 May 2012 16:01:14 +0000 (16:01 +0000)]
[analyzer] Fix RUN lines for old XFAIL tests, one of which actually works.

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

12 years ago[analyzer] Convert many existing tests to use clang_analyzer_eval.
Jordy Rose [Wed, 16 May 2012 16:01:10 +0000 (16:01 +0000)]
[analyzer] Convert many existing tests to use clang_analyzer_eval.

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

12 years ago[analyzer] Introduce clang_analyzer_eval for regression test constraint checks.
Jordy Rose [Wed, 16 May 2012 16:01:07 +0000 (16:01 +0000)]
[analyzer] Introduce clang_analyzer_eval for regression test constraint checks.

The new debug.ExprInspection checker looks for calls to clang_analyzer_eval,
and emits a warning of TRUE, FALSE, or UNKNOWN (or UNDEFINED) based on the
constrained value of its (boolean) argument. It does not modify the analysis
state though the conditions tested can result in branches (e.g. through the
use of short-circuit operators).

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

12 years agoStringSwitchify. No functionality change.
Benjamin Kramer [Wed, 16 May 2012 12:44:25 +0000 (12:44 +0000)]
StringSwitchify. No functionality change.

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

12 years agoFactor sema for attributes unavailable and deprecated into a common function.
Benjamin Kramer [Wed, 16 May 2012 12:19:08 +0000 (12:19 +0000)]
Factor sema for attributes unavailable and deprecated into a common function.

No functionality change.

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

12 years ago[tsan] fix typo
Kostya Serebryany [Wed, 16 May 2012 08:19:13 +0000 (08:19 +0000)]
[tsan] fix typo

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

12 years agoClarify how libstdc++ and other bits of the system toolchain are found
Chandler Carruth [Wed, 16 May 2012 08:18:58 +0000 (08:18 +0000)]
Clarify how libstdc++ and other bits of the system toolchain are found
on Linux in the getting started documentation.

Patch by Nathan Ridge.

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

12 years ago[tsan] first version of ThreadSanitizer docs
Kostya Serebryany [Wed, 16 May 2012 08:14:36 +0000 (08:14 +0000)]
[tsan] first version of ThreadSanitizer docs

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

12 years ago[tsan] add ThreadSanitizer linker flags on Linux and also copy the tsan-rt into...
Kostya Serebryany [Wed, 16 May 2012 06:36:00 +0000 (06:36 +0000)]
[tsan] add  ThreadSanitizer linker flags on Linux and also copy the tsan-rt into the appropriate place at build time

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

12 years agoProduce more useful 'duplicate case' diagnostics. Fixes PR9243, from Terry Long!
Douglas Gregor [Wed, 16 May 2012 05:32:58 +0000 (05:32 +0000)]
Produce more useful 'duplicate case' diagnostics. Fixes PR9243, from Terry Long!

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

12 years agoInclude the correct conversion context locations for condition expressions.
David Blaikie [Wed, 16 May 2012 04:20:04 +0000 (04:20 +0000)]
Include the correct conversion context locations for condition expressions.

This improves the conversion diagnostics (by correctly pointing to the loop
construct for conversions that may've been caused by the contextual conversion
to bool caused by a condition expression) and also causes the NULL conversion
warnings to be correctly suppressed when crossing a macro boundary in such a
context. (previously, since the conversion context location was incorrect, the
suppression could not be performed)

Reported by Nico Weber as feedback to r156826.

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

12 years agoFix the visibility of instantiations of static data members.
Rafael Espindola [Wed, 16 May 2012 02:10:38 +0000 (02:10 +0000)]
Fix the visibility of instantiations of static data members.
Fixes pr12835.

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

12 years ago[libclang/AST] Index references of protocols in "@protocol(...)" syntax.
Argyrios Kyrtzidis [Wed, 16 May 2012 00:50:02 +0000 (00:50 +0000)]
[libclang/AST] Index references of protocols in "@protocol(...)" syntax.

To do that, keep track of the location of the protocol id in the ObjCProtocolExpr
AST node.

rdar://11190837

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

12 years ago[objcmt] Accept char arrays for rewriting to @() syntax.
Argyrios Kyrtzidis [Wed, 16 May 2012 00:21:21 +0000 (00:21 +0000)]
[objcmt] Accept char arrays for rewriting to @() syntax.

Part of rdar://11438360

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

12 years ago[analyzer] Add a test for dead stores, which uses OpaqueValExpr.
Anna Zaks [Tue, 15 May 2012 23:12:53 +0000 (23:12 +0000)]
[analyzer] Add a test for dead stores, which uses OpaqueValExpr.

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

12 years ago[objcmt] When using NSNumber numberWithInteger:/numberWithUnsignedInteger: be
Argyrios Kyrtzidis [Tue, 15 May 2012 22:59:54 +0000 (22:59 +0000)]
[objcmt] When using NSNumber numberWithInteger:/numberWithUnsignedInteger: be
more liberal in rewriting when the parameter is an enum constant.

Part of rdar://11438360

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

12 years agoobjective-c: perform strict type checking on property
Fariborz Jahanian [Tue, 15 May 2012 22:37:04 +0000 (22:37 +0000)]
objective-c: perform strict type checking on property
type and its accessor type and issue error if types
are incompatible, instead of crashing in IRgen.
// rdar://1105153

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

12 years ago[analyzer] Fix a regression in ObjCUnusedIVars checker.
Anna Zaks [Tue, 15 May 2012 22:31:56 +0000 (22:31 +0000)]
[analyzer] Fix a regression in ObjCUnusedIVars checker.

We can no longer rely on children iterator to visit all the AST
tree children of an expression (OpaqueValueExpr has no children).

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

12 years ago[objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
Argyrios Kyrtzidis [Tue, 15 May 2012 22:22:10 +0000 (22:22 +0000)]
[objcmt] Rewrite messages to NSString's stringWithUTF8String:/stringWithCString:
to use the @() boxing syntax.

It will also rewrite uses of stringWithCString:encoding: where the encoding that is
used is NSASCIIStringEncoding or NSUTF8StringEncoding.

rdar://11438360

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

12 years agoDon't warn when NULL is used within a macro but its conversion is outside a macro.
David Blaikie [Tue, 15 May 2012 21:57:38 +0000 (21:57 +0000)]
Don't warn when NULL is used within a macro but its conversion is outside a macro.

This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

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

12 years agoTypo.
Richard Smith [Tue, 15 May 2012 21:42:17 +0000 (21:42 +0000)]
Typo.

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

12 years agoIf we see a declaration which is either missing a type or has a malformed type,
Richard Smith [Tue, 15 May 2012 21:29:55 +0000 (21:29 +0000)]
If we see a declaration which is either missing a type or has a malformed type,
and the thing we have has a scope specifier, and we're in a context that doesn't
allow declaring a qualified name, then the error is a malformed type, not a
missing type.

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

12 years agoDon't use the implicit int rule for error recovery in C++. Instead, try to
Richard Smith [Tue, 15 May 2012 21:01:51 +0000 (21:01 +0000)]
Don't use the implicit int rule for error recovery in C++. Instead, try to
disambiguate whether the type name was forgotten or mistyped.

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

12 years agoAdd the Objective-C runtime linking arguments after user-specified
Douglas Gregor [Tue, 15 May 2012 21:00:27 +0000 (21:00 +0000)]
Add the Objective-C runtime linking arguments after user-specified
linker arguments. Fixes <rdar://problem/11417441>.

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

12 years agoAdd documentation about boxing enum types and a codegen test to make
Argyrios Kyrtzidis [Tue, 15 May 2012 20:45:35 +0000 (20:45 +0000)]
Add documentation about boxing enum types and a codegen test to make
sure we pick up the underlying type, per suggestion by Fariborz.

No functionality change.

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

12 years ago[clang.py] Store reference to TranslationUnit in Cursor and Type
Gregory Szorc [Tue, 15 May 2012 19:51:02 +0000 (19:51 +0000)]
[clang.py] Store reference to TranslationUnit in Cursor and Type

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

12 years ago[objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.
Argyrios Kyrtzidis [Tue, 15 May 2012 19:17:49 +0000 (19:17 +0000)]
[objcmt] Rewrite [NSNumber numberWith*] messages to the new @() boxing syntax.

There are some caveats:
-If an implicit cast (e.g. int -> float for numberWithFloat:) was required, the message
 will not get rewritten
-If the message was with numberWithInteger:/numberWithUnsignedInteger:, which are very
 commonly used, be more liberal and allow the boxing syntax if the underlying type has
 same signedness and will not lose precision.

Part of rdar://11438360

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

12 years agoAllow objc @() syntax for enum types.
Argyrios Kyrtzidis [Tue, 15 May 2012 19:17:44 +0000 (19:17 +0000)]
Allow objc @() syntax for enum types.

Previously we would reject it as illegal using a value of
enum type and on ObjC++ it was illegal to use an enumerator
as well.

rdar://11454917

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

12 years agoDo not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
Bob Wilson [Tue, 15 May 2012 18:57:39 +0000 (18:57 +0000)]
Do not link with Objective-C libraries with -nostdlib or -nodefaultlibs.
<rdar://problem/11433499>

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

12 years agoAdd the output of "clang --version" to scan-build results, from Gerald Combs!
Douglas Gregor [Tue, 15 May 2012 18:41:55 +0000 (18:41 +0000)]
Add the output of "clang --version" to scan-build results, from Gerald Combs!

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

12 years agoobjc: avoid duplicate diagnostics on certain type mismatches
Fariborz Jahanian [Tue, 15 May 2012 18:12:51 +0000 (18:12 +0000)]
objc: avoid duplicate diagnostics on certain type mismatches
between property and its backing ivar.

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

12 years agoRemove word 'block' from option and diagnostic I added
Fariborz Jahanian [Tue, 15 May 2012 17:43:16 +0000 (17:43 +0000)]
Remove word 'block' from option and diagnostic I added
in r156825.

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

12 years agoAllow MCCodeEmitter access to the target MCRegisterInfo.
Jim Grosbach [Tue, 15 May 2012 17:36:07 +0000 (17:36 +0000)]
Allow MCCodeEmitter access to the target MCRegisterInfo.

Add MRI to the createMCCodeEmitter() call.

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

12 years agoChanging std::string to SmallString for r156826.
David Blaikie [Tue, 15 May 2012 17:18:27 +0000 (17:18 +0000)]
Changing std::string to SmallString for r156826.

Based on code review feedback by Jordan Rose.

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

12 years agoImprove some of the conversion warnings to fire on conversion to bool.
David Blaikie [Tue, 15 May 2012 16:56:36 +0000 (16:56 +0000)]
Improve some of the conversion warnings to fire on conversion to bool.

Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

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

12 years agoobjective-c nonfragile abi: discourage ivar declarations
Fariborz Jahanian [Tue, 15 May 2012 16:33:04 +0000 (16:33 +0000)]
objective-c nonfragile abi: discourage ivar declarations
in @interface by issuing warning (off by default) under
opt'ed in flag -Winterface-block-ivar. // rdar://10763173

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

12 years agoFix our handling of visibility in explicit template instantiations.
Rafael Espindola [Tue, 15 May 2012 14:09:55 +0000 (14:09 +0000)]
Fix our handling of visibility in explicit template instantiations.

* Don't copy the visibility attribute during instantiations. We have to be able
  to distinguish

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template DEFAULT void bar<foo>();

from

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template void bar<foo>();

* If an instantiation has an attribute, it takes precedence over an attribute
  in the template.

* With instantiation attributes handled with the above logic, we can now
  select the minimum visibility when looking at template arguments.

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

12 years agoAdd a note about atomic builtins to c11 section of release notes.
David Chisnall [Tue, 15 May 2012 13:18:03 +0000 (13:18 +0000)]
Add a note about atomic builtins to c11 section of release notes.

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

12 years agoFixes crasher bug in JSONCompilationDatabase for invalid input.
Manuel Klimek [Tue, 15 May 2012 11:46:07 +0000 (11:46 +0000)]
Fixes crasher bug in JSONCompilationDatabase for invalid input.

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

12 years agoadd embedded linux variants that occur in the field
Gabor Greif [Tue, 15 May 2012 11:21:03 +0000 (11:21 +0000)]
add embedded linux variants that occur in the field

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

12 years agoThis patch fixes the cmake build to create libclang.so/libclang.a on linux
Manuel Klimek [Tue, 15 May 2012 08:58:48 +0000 (08:58 +0000)]
This patch fixes the cmake build to create libclang.so/libclang.a on linux
instead of liblibclang.so/liblibclang.a.

Patch by Arnaud de Grandmaison.

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

12 years agoFurther improvement to wording of overload resolution diagnostics, and including
Richard Smith [Tue, 15 May 2012 06:21:54 +0000 (06:21 +0000)]
Further improvement to wording of overload resolution diagnostics, and including
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!

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

12 years agoPR12798: Don't drop part of the nested name specifier when instantiating a
Richard Smith [Tue, 15 May 2012 06:15:11 +0000 (06:15 +0000)]
PR12798: Don't drop part of the nested name specifier when instantiating a
pseudo-destructor expression. This can affect whether virtual dispatch for
the destructor call is bypassed.

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

12 years agoTest file I forgot to 'svn add' in r156802.
Richard Smith [Tue, 15 May 2012 05:39:53 +0000 (05:39 +0000)]
Test file I forgot to 'svn add' in r156802.

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

12 years agoPR12826: Converting an lvalue to an xvalue is a no-op conversion, not an lvalue-to...
Richard Smith [Tue, 15 May 2012 05:04:02 +0000 (05:04 +0000)]
PR12826: Converting an lvalue to an xvalue is a no-op conversion, not an lvalue-to-rvalue conversion.

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

12 years agoFold the six functions checking explicitly-defaulted special member functions
Richard Smith [Tue, 15 May 2012 04:39:51 +0000 (04:39 +0000)]
Fold the six functions checking explicitly-defaulted special member functions
into one. These were all performing almost identical checks, with different bugs
in each of them.

This fixes PR12806 (we weren't setting the exception specification for an
explicitly-defaulted, non-user-provided default constructor) and enforces
8.4.2/2's rule that an in-class defaulted member must exactly match the implicit
parameter type.

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

12 years agoChange the mangling of a ref-qualifier on a function type so that
John McCall [Tue, 15 May 2012 02:01:59 +0000 (02:01 +0000)]
Change the mangling of a ref-qualifier on a function type so that
it is placed in a position which is never ambiguous with a
reference-to-function type.  This follows some recent discussion
and ensuing proposal on cxx-abi-dev.  It is not necessary to
change the mangling of CV-qualifiers because you cannot
apply CV-qualification in the normal sense to a function type.
It is not necessary to change the mangling of ref-qualifiers on
method declarations because they appear in an unambiguous
location.

In addition, mangle CV-qualifiers and ref-qualifiers on function
types when they occur in positions other than member pointers
(that is, when they appear as template arguments).

This is a minor ABI break with previous releases of clang.  It
is not considered critical because (1) ref-qualifiers are
relatively rare, since AFAIK we're the only implementing compiler,
and (2) they're particularly likely to come up in contexts that
do not rely on the ODR for correctness.  We apologize for any
inconvenience;  this is the right thing to do.

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

12 years ago[objcmt] When rewriting to subscripting syntax, make sure we put
Argyrios Kyrtzidis [Mon, 14 May 2012 23:33:49 +0000 (23:33 +0000)]
[objcmt] When rewriting to subscripting syntax, make sure we put
the receiver in parentheses when necessary.

Part of rdar://11438360

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

12 years agoobjc: allow typedef'ing an id to a pointer to a c-struct only.
Fariborz Jahanian [Mon, 14 May 2012 22:48:56 +0000 (22:48 +0000)]
objc: allow typedef'ing an id to a pointer to a c-struct only.
// rdar://11356439

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

12 years agoRecover properly from a redundant 'typename' before a non-nested name. This is
Richard Smith [Mon, 14 May 2012 22:43:34 +0000 (22:43 +0000)]
Recover properly from a redundant 'typename' before a non-nested name. This is
permitted as a Microsoft extension. Patch by William Wilson! (Plus some minor
tweaking by me.)

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

12 years ago[analyzer] Fix a crash in templated code which uses blocks.
Anna Zaks [Mon, 14 May 2012 22:38:24 +0000 (22:38 +0000)]
[analyzer] Fix a crash in templated code which uses blocks.

We should investigate why signature info is not set in this case.

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

12 years agoSlightly generalize FileCheck patterns to unbreak -Asserts builds.
Richard Smith [Mon, 14 May 2012 22:06:02 +0000 (22:06 +0000)]
Slightly generalize FileCheck patterns to unbreak -Asserts builds.

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

12 years ago[objcmt] When rewriting to array/dictionary literals, add an explicit
Argyrios Kyrtzidis [Mon, 14 May 2012 22:01:53 +0000 (22:01 +0000)]
[objcmt] When rewriting to array/dictionary literals, add an explicit
cast to 'id' for any argument that requires it.

Part of rdar://11438360.

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

12 years agoImplement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and the
Richard Smith [Mon, 14 May 2012 21:57:21 +0000 (21:57 +0000)]
Implement IRGen for C++11's "T{1, 2, 3}", where T is an aggregate and the
expression is treated as an lvalue.

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

12 years agoTeach the driver on Linux to respect -nodefaultlibs.
Chandler Carruth [Mon, 14 May 2012 18:31:18 +0000 (18:31 +0000)]
Teach the driver on Linux to respect -nodefaultlibs.

Patch from Andrew C. Morrow.

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

12 years ago[analyzer] strncpy: Special-case a length of 0 to avoid an incorrect warning.
Jordy Rose [Mon, 14 May 2012 17:58:35 +0000 (17:58 +0000)]
[analyzer] strncpy: Special-case a length of 0 to avoid an incorrect warning.

We check the address of the last element accessed, but with 0 calculating that
address results in element -1. This patch bails out early (and avoids a bunch
of other work at that).

Fixes PR12807.

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