Граф коммитов

15122 Коммитов

Автор SHA1 Сообщение Дата
NAKAMURA Takumi e5756792d2 test/Driver/crash-report.c: Small tweaks. 1) Use %t instead %T for TMP. 2) Set all of $TMPDIR, $TEMP and $TMP, or a certain host might set $TEMP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160342 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 05:09:20 +00:00
Rafael Espindola becfc2325c Record visibility pragmas when we see a tag declaration. We might use it
to build a type before seeing the definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 04:22:25 +00:00
Richard Smith 6cfa78f6bd Uninitialized variables: two little changes:
* Treat compound assignment as a use, at Jordy's request.
 * Always add compound assignments into the CFG, so we can correctly diagnose the use in 'return x += 1;'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160334 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 01:27:33 +00:00
NAKAMURA Takumi 3df9a756d6 clang/test/Tooling/clang-ast-dump.cpp: Mark it as REQUIRES: asserts, for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160332 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 00:33:36 +00:00
Richard Smith 9532e0d89c -Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.

This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160330 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-17 00:06:14 +00:00
Jordan Rose 89e5aaf57e [analyzer] Handle new-expressions with initializers for scalars.
<rdar://problem/11818967>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160328 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 23:38:09 +00:00
Jordan Rose b04a45720b Weaken Unicode fixit test to work even if the character is printed escaped.
This should fix the failure on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 22:18:33 +00:00
Ted Kremenek ee07db7d91 This test appears to fail on win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160322 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 21:43:16 +00:00
Ted Kremenek 3b71176b17 This test appears to be passing on win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160320 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 21:17:01 +00:00
Jordan Rose 6f977c3e79 Don't crash when emitting fixits following Unicode characters.
This code is very sensitive to the difference between "columns" as printed
and "bytes" (SourceManager columns). All variables are now named explicitly
and our assumptions are (hopefully) documented as both comment and assertion.

Whether parseable fixits should use byte offsets or Unicode character counts
is pending discussion on the mailing list; currently the implementation uses
bytes (and has no problems on lines containing multibyte characters).
This has been added to the user manual.

<rdar://problem/11877454>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160319 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 20:52:12 +00:00
Simon Atanasyan d7bad053b0 MIPS: Implement __builtin_mips_shll_qb builtin function overloading.
This function has two versions. The first one is used for a register operand.
The second one is used for an immediate number.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160308 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 18:52:02 +00:00
David Blaikie 85f485a70f Fix rejects-valid: explicit specialization of redeclared deleted function template.
Review by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160306 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 18:50:45 +00:00
Alexander Kornienko 6e39d05d4e Fixing an obvious bug in a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160268 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 13:31:37 +00:00
Alexander Kornienko dea8fba3c6 The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160265 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 12:46:48 +00:00
Daniel Jasper a770a4daf7 Add correct parenthesis range to CXXConstructExprs inside
CXXFunctionalCastExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160252 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 08:05:07 +00:00
Richard Smith aa488ea287 More for PR11848: a pack expansion type isn't necessarily type-dependent (its
pattern might be an alias template which doesn't use its arguments). It's always
instantiation-dependent, though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160246 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 01:59:26 +00:00
Richard Smith 7e54fb5fcc PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160245 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 01:09:10 +00:00
Richard Smith d8672ef2d3 Related to PR11848 and core-21989: switch ContainsUnexpandedParameterPack from
being a property of a canonical type to being a property of the fully-sugared
type. This should only make a difference in the case where an alias template
ignores one of its parameters, and that parameter is an unexpanded parameter
pack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160244 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 00:20:35 +00:00
Richard Smith f5baeb4af5 PR13368: Halve the instantiation depth of this test again. Apparently, FreeBSD
has a much lower default stack limit than the systems I have access to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160240 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 23:29:50 +00:00
David Chisnall e091e95495 Add test case for tweaks to clang driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160236 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 21:18:01 +00:00
Rafael Espindola d320ffc0f5 Without this patch clang warns on
struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("hidden"))) zed;

Which is a bit silly and got a lot noisier now that we correctly handle
visibility pragmas. This patch fixes that and also has some extra quality
improvements:

* We now produce an error instead of a warning for

struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("default"))) zed;

* The "after definition" warning now points to the new attribute that is
  ignored instead of pointing to the declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160227 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 01:33:40 +00:00
Eric Christopher 2b884a873a Use llvm::APSInt::isSameValue to compare for the same value.
Finishes rdar://11875995

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160225 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-15 00:24:00 +00:00
Ted Kremenek 3f635c08b2 Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively.  This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.

Note that this patch only alters the branches 'while', 'if' and 'for'.  This was complex enough for
one patch.  The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.

It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160218 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-14 05:04:10 +00:00
Chad Rosier f9e9af7df0 Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX).  Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size.  Thus, very large vectors will be over-aligned with no 
benefit.  Target owners should set this target max.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160209 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 23:57:43 +00:00
Richard Smith 558e8872b3 PR13360: When deciding the earliest point which inevitably leads to an
uninitialized variable use, walk back over branches where we've reached all the
non-null successors, not just cases where we've reached all successors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160206 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 23:33:44 +00:00
Nuno Lopes f195f2cacf add support for conditional expressions in Expr::HasSideEffects()
This fixes a bug in __builtin_object_size() codegen

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160191 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 20:48:52 +00:00
Tanya Lattner 916ea6522a Move a bunch of the attribute warnings under the IgnoreAttributes group. Cleaned up test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160190 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 20:45:35 +00:00
Rafael Espindola 6b60370ddb Apply visibility pragmas to class template declarations. This is needed because
we might use the declaration to build a type before seeing the definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160176 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 18:04:45 +00:00
Rafael Espindola b04b731220 Use -fvisibility-inlines-hidden in inline functions too. This matches gcc
behavior since gcc pr30066. Thanks to Benjamin Kramer for pointing it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160174 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 14:25:36 +00:00
Richard Smith 838925dc84 Provide a special-case diagnostic when two class member functions instantiate
to the same signature. Fix a bug in the type printer which would cause this
diagnostic to print wonderful types like 'const const int *'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160161 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 04:12:04 +00:00
Rafael Espindola d3d02dd0ae Fix a bug in my previous commit. The problem is not that we were not using the
canonical decl for the template, but that we were not merging attributes for
templates at all!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 01:19:08 +00:00
Dmitri Gribenko abd56c816e Attaching comments to declarations during parsing: handle more Objective-C declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160156 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 01:06:46 +00:00
Dmitri Gribenko 3f38bf2d44 Comment parsing: repaint the bikesched: rename 'HTML open tags' to 'HTML start tags' and 'HTML close tags' to 'HTML end tags' according to HTML spec.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160153 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 00:44:24 +00:00
Dmitri Gribenko 3d986980bd Make concepts of optional and forbidden end tags separate. Thanks Jordan for pointing this!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160149 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 23:37:09 +00:00
Rafael Espindola 23458208b2 Use the canonical template decl when trying to find if it has a visibility
attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160139 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 20:05:04 +00:00
Timur Iskhodzhanov f9aed96537 [Windows] Split the back reference tests into two separate files as the templates are getting hairy
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160131 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 14:33:58 +00:00
NAKAMURA Takumi 6fcac5dacc test/CodeGen/rdrand-builtins.c: Define __MM_MALLOC_H before including <*mmintrin.h> .
Rawr!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160125 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 10:36:27 +00:00
Benjamin Kramer a1c387ede2 Don't include mm_malloc.h in test, it pulls in system headers on msvc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 09:56:18 +00:00
Timur Iskhodzhanov 8f88a1dcc5 [Windows] Use thiscall as the default calling convention for class methods. PR12785
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160121 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 09:50:54 +00:00
Benjamin Kramer 9a50249cd3 Add _rdrand{16,32,64}_step intrinsics to immintrin.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160118 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 09:33:03 +00:00
Benjamin Kramer c7bd9fbecd Be lax about trailing whitespace when checking fixit formatting, this depends on locale settings.
If a non-unicode locale is used, the unicode character is escaped and any
byte that is in the escaped representation but not the semicolon will
become whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160113 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 08:34:31 +00:00
Benjamin Kramer af082c3b16 PR13312: Don't crash when printing a fixit that ends in a unicode character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160112 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 08:20:49 +00:00
Rafael Espindola 5e06529f3b Process #pragma visibility early in the parsing of class definitions. Fixes
pr13338.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160105 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 04:47:34 +00:00
Rafael Espindola f729ce0b23 Ignore visibility attributes after definitions. This matches newer (4.7) gcc's
behavior and is the first step in fixing pr13338.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160104 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 04:32:30 +00:00
John McCall f7226fbe67 Add the ObjFW runtime. Patch by Jonathan Schleifer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160102 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 02:07:58 +00:00
Jordan Rose c36b30c92c [analyzer] Don't inline virtual calls unless we can devirtualize properly.
Previously we were using the static type of the base object to inline
methods, whether virtual or non-virtual. Now, we try to see if the base
object has a known type, and if so ask for its implementation of the method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160094 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 00:16:25 +00:00
Tanya Lattner 198871cc90 Add OpenCL metadata for kernel arg names. This output is controlled via a flag as noted in the OpenCL Spec.
Includes a test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160092 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 23:02:10 +00:00
Nico Weber 8951067a2b Don't try to do RVO on block variables that refer to an enclosing local.
Fixes PR13314, clang crashing on blocks refering to an enclosing local
when the enclosing function returns void.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160089 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 22:50:15 +00:00
Richard Smith e3f470a718 Stop instantiating a class if we hit a static_assert failure. Also, if the
static_assert fails when parsing the template, don't diagnose it again on every
instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160088 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 22:37:56 +00:00
Dmitri Gribenko a5ef44ff5d Enable comment parsing and semantic analysis to emit diagnostics. A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by 
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to 
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160078 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 21:38:39 +00:00
Jordan Rose 4b49756fdc Start testing some commented-out cases of badly-formed __has_include.
Filed PR13334 for the cases that cause the compiler to crash, and
PR13335 for the cases where we should be recovering more gracefully.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160070 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 20:12:19 +00:00
Jordan Rose 78541c4330 Allow -verify directives to be filtered by preprocessing.
This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 19:58:23 +00:00
Rafael Espindola 8d71918ec9 Handle #pragma visibility in explicit specializations and enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160057 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 18:14:09 +00:00
Justin Holewinski 9903e94bee Fix handling of curly braces in NVPTX inline asm
Fixes bug 13322

Patch by Dmitry Mikushin

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160050 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 15:34:55 +00:00
Eric Christopher c852e9ff06 Temporarily revert this to see if it brings the gdb bot back.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 15:32:13 +00:00
NAKAMURA Takumi 0ca4be3c9a clang/test/Misc/diag-template-diffing-color.cpp: Introduce the feature 'ansi-escape-sequences'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160043 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 11:44:00 +00:00
Rafael Espindola f2f15b3bc6 Don't process #pragma visibility during instantiation. The visibility of the
instantiation depends on the template, its arguments and parameters, but not
where it is instantiated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160034 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 02:15:51 +00:00
Eric Christopher 3d40f96394 The end of a block doesn't necessarily need a line table entry unless
there's something going on there. Remove the unconditional line entry
and only add one if we're emitting cleanups (any other statements
would be handled normally).

Fixes rdar://9199234

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 01:49:26 +00:00
Eric Christopher 81e5a936a5 FileCheck-ize.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160032 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 01:49:24 +00:00
Jordan Rose 5ef6e94b29 [analyzer] Guard against C++ member functions that look like system functions.
C++ method calls and C function calls both appear as CallExprs in the AST.
This was causing crashes for an object that had a 'free' method.

<rdar://problem/11822244>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160029 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 23:13:01 +00:00
Richard Smith a4334dffde Fix crash when constant-evaluating a CXXConstructExpr representing
value-initialization for an array of class type with a trivial default
constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160024 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 22:12:55 +00:00
Jordan Rose e54cfc7b99 [analyzer] Use CallEvent for building inlined stack frames.
In order to accomplish this, we now build the callee's stack frame
as part of the CallEnter node, rather than the subsequent BlockEdge node.
This should not have any effect on perceived behavior or diagnostics.

This makes it safe to re-enable inlining of member overloaded operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 22:07:57 +00:00
DeLesley Hutchins 1310611706 Thread safety analysis: impove handling of trylock expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160018 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 21:47:55 +00:00
Arnaud A. de Grandmaison 4187df5f7b Adds support for auto-detection of compilation databases, looking in a directory and all its parents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 16:56:35 +00:00
Manuel Klimek e265c87793 Fixes the MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159992 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 14:21:30 +00:00
Manuel Klimek 8fa2fb859a Adds support for auto-detection of compilation databases
from a source file and changes clang-check to make use of this.

This makes clang-check just work on in-tree builds, and allows
easy setup via a symlink per source directory to make clang-check
work without any extra configuration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159990 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 13:10:51 +00:00
Tanya Lattner 002bb8f7ee TEMPORARY. I will fix this properly shortly.
Silence buildbot so I can figure out the right flag to put this warning under.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 23:01:07 +00:00
Tanya Lattner 0df579ec00 Patch by Anton Lokhmotov to add OpenCL work group size attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159965 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 22:06:01 +00:00
Fariborz Jahanian 6749ae1dbc objective-c: provide fixit hint for @autoreleasepool
and similar other keywords. // rdar://10723084


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159956 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 20:00:35 +00:00
Jim Grosbach f794705837 Tests: check for target availability for target-specific tests.
Lots of tests are using an explicit target triple w/o first checking that the
target is actually available. Add a REQUIRES clause to a bunch of them. This should
hopefully unbreak bots which don't configure w/ all targets enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159949 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 18:34:21 +00:00
Fariborz Jahanian d57aa886f0 objective-c: yank any use of "non-fragile abi" phrase
from diagnostics. // rdar://9657485


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 17:54:36 +00:00
Jordan Rose 94f29f4bf5 Better parser recovery in Objective-C containers.
Previously it was possible to get an infinite-loop-on-invalid with a namespace
decl within @interface. Since 'namespace' is normally a safe place to retry
top-level parsing, we just didn't consume the token.

This adds a flag that tracks whether we have temporarily left Objective-C
scope to parse a C-like declaration, and uses that to better recover from
parse problems by stopping at possible method declarations and at @end. To
fix the original problem, we do /not/ stop at 'namespace' when in an
Objective-C @interface or @protocol context (but still do in @implementation).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159941 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 16:54:53 +00:00
Jordan Rose ee158bc29b [analyzer] When inlining, make sure we use the definition decl.
This was a regression introduced during the CallEvent changes; a call to
FunctionDecl::hasBody was also being used to replace the decl found by
lookup with the actual definition. To keep from making this mistake again
(particularly if/when we start inlining Objective-C methods), this commit
adds a "getDefinition()" method to CallEvent, which should do the right
thing under any circumstances.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159940 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 16:54:49 +00:00
Jordan Rose 6deae7cc8d Downgrade the "direct comparison" error for ObjC literals to a warning.
Chris pointed out that while the comparison is certainly problematic
and does not have well-defined behavior, it isn't any worse than some
of the other abuses that we merely warn about and doesn't need to make
the compilation fail.

Revert the release notes change (r159766) now that this is just a new warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159939 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 16:54:44 +00:00
Richard Smith 6098381c29 PR13136:
* When substituting a reference to a non-type template parameter pack where the
   corresponding argument is a pack expansion, transform into an expression
   which contains an unexpanded parameter pack rather than into an expression
   which contains a pack expansion. This causes the SubstNonTypeTemplateParmExpr
   to be inside the PackExpansionExpr, rather than outside, so the expression
   still looks like a pack expansion and can be deduced.

 * Teach MarkUsedTemplateParameters that we can deduce a reference to a template
   parameter if it's wrapped in a SubstNonTypeTemplateParmExpr (such nodes are
   added during alias template substitution).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159922 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 03:07:20 +00:00
Richard Smith 6ff6cfe696 Halve template depth in an attempt to get this test passing on mingw32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159917 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 21:06:29 +00:00
NAKAMURA Takumi fff457fc28 test/SemaTemplate/instantiation-depth-defarg.cpp: Mark as XFAIL:mingw for now.
I'll try to increase stack size later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159912 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 09:35:16 +00:00
Simon Atanasyan fad0a32da8 MIPS: Range check __builtin_mips_wrdsp / __builtin_mips_rddsp arguments against the upper/lower values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159911 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 09:30:00 +00:00
Simon Atanasyan e471d87a27 MIPS: Mark arguments of __builtin_mips_wrdsp / __builtin_mips_rddsp as a constant expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159910 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 09:10:14 +00:00
Richard Smith 5a343d7856 PR13243: When deducing a non-type template parameter which is specified as an
expression, skip over any SubstNonTypeTemplateParmExprs which alias templates
may have inserted before checking for a DeclRefExpr referring to a non-type
template parameter declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159909 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 04:37:51 +00:00
Richard Smith 8ad6c8696a PR13293: Defer deduction of an auto type with a dependent declarator, such as "auto (*f)(T t)".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159908 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 04:13:07 +00:00
Richard Smith ab91ef1dbe PR9793: Treat substitution as an instantiation step for the purpose of the
-ftemplate-depth limit.  There are various ways to get an infinite (or merely
huge) stack of substitutions with no intervening instantiations. This is also
consistent with gcc's behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159907 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 02:38:24 +00:00
Richard Smith bb35151a16 Reject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
misreduction of PR13290.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159905 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 23:00:31 +00:00
Richard Smith de31aa7f0e PR13290: Constant-evaluation support for CXXConstructExprs which construct a
multidimensional array of class type. Also, preserve zero-initialization when
evaluating an initializer list for an array, in case the initializers refer to
later elements (which have preceding zero-initialization).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 22:48:24 +00:00
NAKAMURA Takumi 254a8fb01c clang/test/CodeGenCXX/cxx0x-initializer-constructors.cpp: Fixup for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159898 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 10:25:42 +00:00
Benjamin Kramer 84f30809a2 Wire up -mrdrnd for X86.
For some reason GCC decided to call the feature rdrnd instead of rdrand,
which requires translating it for LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159897 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 09:39:18 +00:00
Richard Smith 20599392a9 PR12670: Support for initializing an array of non-aggregate class type from an
initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge
and Daniel Lunow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 08:35:56 +00:00
Richard Smith ff817f7070 When marking virtual functions as used for a class' vtable, mark all functions
which will appear in the vtable as used, not just those ones which were
declared within the class itself. Fixes an issue reported as comment#3 in
PR12763 -- we sometimes assert in codegen if we try to emit a reference to a
function declaration which we've not marked as referenced. This also matches
gcc's observed behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159895 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 06:59:51 +00:00
Ted Kremenek a437b84765 Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 06:30:31 +00:00
Ted Kremenek e8cf7d1434 Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi 3b4c532596 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 02:48:02 +00:00
Dmitri Gribenko 9c00676f23 Restrict the set of declaration kinds for which we allow trailing comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159878 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 23:27:33 +00:00
Ted Kremenek 25570a94ca Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159875 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 23:07:31 +00:00
Jordan Rose 48088ed56f [analyzer] Fix mis-committed test. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159869 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 22:10:39 +00:00
Jordan Rose 752bee2493 [analyzer] Be careful about LazyCompoundVals, which may be for the first field.
We use LazyCompoundVals to avoid copying the contents of structs and arrays
around in the store, and when we need to pass a struct around that already
has a LazyCompoundVal we just use the original one. However, it's possible
that the first field of a struct may have a LazyCompoundVal of its own, and
we currently can't distinguish a LazyCompoundVal for the first element of a
struct from a LazyCompoundVal for the entire struct. In this case we should
just drop the optimization and make a new LazyCompoundVal that encompasses
the old one.

PR13264 / <rdar://problem/11802440>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159866 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 21:59:56 +00:00
Fariborz Jahanian bd2e27e848 objc-arc: warn when assigning retained object to
a 'weak' property just as we do the same for
'weak' variables. // rdar://11814185


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159859 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 21:09:27 +00:00
Fariborz Jahanian 4d3db4eb6c objective-c++11: extend c++11 range-based loop to iterate
over objective-c container collection. // rdar://9293227


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:04:04 +00:00
NAKAMURA Takumi 102bab77ef clang/test/CodeGen/fp-contract.c: It requires ppc32!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159816 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 11:11:27 +00:00
Lang Hames c9686716d2 Add -ffp-contract = { fast | on | off } command line option support.
This flag sets the 'fp-contract' mode, which controls the formation of fused
floating point operations. Available modes are:

- Fast: Form fused operations anywhere. 
- On: Form fused operations where allowed by FP_CONTRACT. This is the default
      mode.
- Off: Don't form fused operations (in future this may be relaxed to forming
       fused operations where it can be proved that the result won't be
       affected).

Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off'
modes are equivalent.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159794 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:59:19 +00:00
Argyrios Kyrtzidis 1838703fea [objcmt] Check for classes that accept 'objectForKey:' (or the other selectors
that the migrator handles) but return their instances as 'id', resulting
in the compiler resolving 'objectForKey:' as the method from NSDictionary.

When checking if we can convert to subscripting syntax, check whether
the receiver is a result of a class method from a hardcoded list of
such classes. In such a case return the specific class as the interface
of the receiver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:07:09 +00:00