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

16569 Коммитов

Автор SHA1 Сообщение Дата
NAKAMURA Takumi 8fd7f67e24 clang/test/CodeGen/2008-01-07-UnusualIntSize.c: Add triple x86_64. It doesn't assume 32-bit target, for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 12:05:25 +00:00
Chandler Carruth 72d2dab605 Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 11:14:44 +00:00
Ted Kremenek b929f6636c Use the BlockDecl captures list to infer the direct captures for a BlockDataRegion. Fixes <rdar://problem/12415065>.
We still need to do a recursive walk to determine all static/global variables
referenced by a block, which is needed for region invalidation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 07:17:26 +00:00
Richard Smith 030a6644f2 Fix http://stackoverflow.com/questions/13521163
Don't require that, during template deduction, a template specialization type
as a function parameter has at least as many template arguments as one used in
a function argument (not even if the argument has been resolved to an exact
type); the additional parameters might be provided by default template
arguments in the template. We don't need this check, since we now implement
[temp.deduct.call]p4 with an additional check after deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169475 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 06:44:44 +00:00
Richard Smith d5e8394297 Don't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscure record layout bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169467 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 03:04:50 +00:00
NAKAMURA Takumi c213262e4a Disable clang/test/Preprocessor/macro-multiline.c for now, while investigating lit.ShUtil.parser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169458 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 01:09:31 +00:00
Fariborz Jahanian 5c6ae4bd89 more test of template declarations in a
<declaration> XML tag. // rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169457 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 00:57:28 +00:00
Fariborz Jahanian 5e0ea1994b More C++ testing of declarations embedded in
<declaration> tag of Comment XML  and fixing 
DeclPrint of templates along the way - wip. 
//rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169453 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-06 00:09:40 +00:00
Chad Rosier e23fbf1fca [driver, ms-inline asm] Have -fms-extensions enable the AsmBlocks language
option.  MS-style inline asm can now be enabled by either -fasm-blocks or
-fms-extensions.
rdar://12808010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169445 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 23:08:09 +00:00
Richard Smith 95d8255917 Looks like lit on Windows can't cope with parens here, and in any case, we shouldn't need them after r169441.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169442 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 22:59:28 +00:00
Richard Smith 9867ebaac9 More workarounds for PR10867.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 22:33:14 +00:00
Richard Smith ca95228161 Fix an egregiously broken test. This pattern doesn't work:
RUN: a
RUN: b || true

lit expands it to a && b || true, and the || true applies to both commands (thus ignoring failures in 'a')! This is PR10867 again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169434 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 22:18:04 +00:00
Bill Wendling 5e45385ba7 Fix name. The array is unboundED.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169429 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 21:43:37 +00:00
Chad Rosier 15490fd42d [driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag.
rdar://12808010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 21:08:21 +00:00
Fariborz Jahanian 02a2e5a1dd Testing C++ declarations embedded in
<declaration> tag of Comment XML.
Added DeclPrint support for constructors
and fix tests accordingly.
This is wip. // rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 19:54:11 +00:00
Chad Rosier e0c0196351 [ms-inline asm] Add more tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169411 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 19:52:05 +00:00
Jordan Rose 2cd3440369 Format strings: offer a cast to 'unichar' for %C in Objective-C contexts.
For most cases where a conversion specifier doesn't match an argument,
we usually guess that the conversion specifier is wrong. However, if
the argument is an integer type and the specifier is %C, it's likely
the user really did mean to print the integer as a character.

(This is more common than %c because there is no way to specify a unichar
literal -- you have to write an integer literal, such as '0x2603',
and then cast it to unichar.)

This does not change the behavior of %S, since there are fewer cases
where printing a literal Unicode *string* is necessary, but this could
easily be changed in the future.

<rdar://problem/11982013>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169400 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 18:44:49 +00:00
Jordan Rose 17ddc54b8b Format strings: add more expression types that don't need parens to cast.
No functionality change (the test change is a comment only, and the new
functionality can't be tested using the current test).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169399 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 18:44:44 +00:00
Jordan Rose 448ac3e6d1 Format strings: a character literal should be printed with %c, not %d.
The type of a character literal is 'int' in C, but if the user writes a
character /as/ a literal, we should assume they meant it to be a
character and not a numeric value, and thus offer %c as a correction
rather than %d.

There's a special case for multi-character literals (like 'MooV'), which
have implementation-defined value and usually cannot be printed with %c.
These still use %d as the suggestion.

In C++, the type of a character literal is 'char', and so this problem
doesn't exist.

<rdar://problem/12282316>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169398 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 18:44:40 +00:00
Jordan Rose ff7be48165 Format strings: the correct conversion for 'char' is %c, not %d or %hhd.
We tried to account for 'uint8_t' by saying that /typedefs/ of 'char'
should be corrected as %hhd rather than %c, but the condition was wrong.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169397 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 18:44:37 +00:00
Evgeniy Stepanov 99469f732e Reuse an existing diagnostic for tsan/msan needing -pie error.
Add a diagnosting for -fsanitize=memory conflicting with other sanitizers.
Extend tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169380 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 13:37:12 +00:00
NAKAMURA Takumi 9ec98f2663 test/Modules/build-fail-notes.m: Tweak to unbreak Win32 hosts to relax expressions, for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 11:52:45 +00:00
Richard Smith 37ec8d589c In C++, if we hit an error in the class-head, don't try to parse the class body.
Our error recovery path may have made the class anonymous, and that has a pretty
disastrous impact on any attempt to parse a class body containing constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 11:34:06 +00:00
Richard Smith 5b10af7aa9 PR14049: Don't say "expanded from macro 'foo'" when 'foo' just happens to be
the LHS of a token paste. Use "expanded from here" instead when we're not sure
it's actually a macro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169373 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 11:04:55 +00:00
Richard Smith d515e62c7f This test used to fail forever if it failed once, because it does not clean up after itself if it failed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169356 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 06:16:54 +00:00
DeLesley Hutchins 91e2061763 Thread-safety analysis: check locks on method calls, operator=, and
copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169350 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 01:20:45 +00:00
Anna Zaks 39a62fcd30 [analyzer] Implement an opt-in variant of direct ivar assignment.
This will only check the direct ivar assignments in the annotated
methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169349 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 01:14:37 +00:00
Fariborz Jahanian 8920eb7a95 Testing C++ declarations embedded in
<declaration> tag of Comment XML and 
added support for friend declaration printing.
This is wip. // rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169346 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 00:38:44 +00:00
Chandler Carruth 1d1539875b Add -whole-archive around the ASan runtime archive in the link command.
This ensures that even though it comes first, we pick up its .o files.
Note that if we can use this (or something similar / equivalent) on
other platforms, we could potentially remove
ReplaceOperatorsNewAndDelete from the ASan runtimes.

We should probably do something similar for TSan and MSan as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169328 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 22:54:37 +00:00
Bill Wendling 9d05986cc5 Use the 'count' attribute to calculate the upper bound of an array.
The count attribute is more accurate with regards to the size of an array. It
also obviates the upper bound attribute in the subrange. We can also better
handle an unbound array by setting the count to -1 instead of the lower bound to
1 and upper bound to 0.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169311 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 21:33:58 +00:00
Matt Beaumont-Gay 45b27380a2 Currently, with -fsanitize=address, the driver appends libclang_rt.asan.a to
the link command. This all works fine when the driver is also responsible for
adding -lstdc++ to the link command. But, if -lstdc++ (or libstdc++.a, etc) is
passed explicitly to the driver, the ASan runtime will appear in the link
command after the standard library, leading to multiple-definition errors for
the global 'operator new' and 'operator delete'. Fix this in a painfully
simple way, by inserting libclang_rt.asan.a at the start of the link command
instead of the end.

If we need to do something more clever, we can walk the link command looking
for something that resembles libstdc++ and insert libclang_rt.asan.a as late
as possible, but the simple solution works for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169310 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 21:18:26 +00:00
Fariborz Jahanian 3e2fe86dd0 Testing C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing block literal printout as result of the testing. 
// rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169307 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 21:15:23 +00:00
Fariborz Jahanian c2ef5ad5f4 additional test for declaration tag of a class extension.
// rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 18:25:34 +00:00
Fariborz Jahanian ff685c562c objective-c blocks: Consider padding due to alignment
after the fixed size block header when generating
captured block variable info. // rdar://12773256


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169285 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 17:20:57 +00:00
Dmitri Gribenko 1eb60825f0 libclang: Add a function to libclang for retrieving the bit width value
Patch by Jyun-Yan You.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169276 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 15:13:46 +00:00
Bill Wendling c4475eee42 Don't test for ASM output but for IR output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169232 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 07:33:40 +00:00
NAKAMURA Takumi 1fec8fcfff clang/test/CodeGenCXX/debug-info-zero-length-arrays.cpp: Add explicit triple, x86_64-unknown-unknown. It was incompatible to i686.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169220 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 06:58:05 +00:00
Bill Wendling 003ec237ad Add a 'count' field to the DWARF subrange.
The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169219 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 06:21:27 +00:00
NAKAMURA Takumi 60ef8b7266 clang/test/Index/comment-objc-decls.m: Try to fix r169193, to add x86_64-darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169199 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 01:03:31 +00:00
Fariborz Jahanian 482b4fd1aa Testing objective-C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing declaration of ivars private to @implementation
as result of the testing. // rdar://12378714


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169193 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 00:47:33 +00:00
Michael Ilseman cdeb7d57a4 Have clang use LLVM IR's fast-math flags when in FastMath or FiniteMathOnly modes. Test cases included.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169191 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 00:36:06 +00:00
NAKAMURA Takumi e0af843b9f clang/test/Driver/fsanitize-blacklist.c: Mark it as XFAIL:cygming, due to PR12920.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169180 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 23:29:49 +00:00
Alexey Samsonov 91ecfa6af5 Add Clang flags -fsanitize-blacklist and -fno-sanitize-blacklist. Make this flag usable for ASan. Blacklisting can be used to disable sanitizer checks for particular file/function/object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169144 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 19:12:58 +00:00
Alexey Samsonov 96a6639264 Fix PR14474: don't emit debug info for interface types in -gline-tables-only mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169138 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-03 18:28:12 +00:00
Will Dietz ad95481b27 [ubsan] Add flag to enable recovery from checks when possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169114 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-02 19:50:33 +00:00
Simon Atanasyan bda07ace55 [MIPS] Add -mxgot/-mno-xgot command line options
to enable/disable support of GOT larger than 64k.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169098 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 18:27:21 +00:00
Eli Bendersky ac5586591a Fix a test that was redefining FileCheck variables while referencing old ones.
In preparation for the FileCheck enhancement to support backreferences.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169090 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 13:50:51 +00:00
Joey Gouly 4247d9c396 Switch to using -### as mentioned by chandlerc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169089 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 13:07:22 +00:00
Joey Gouly acb860f8f8 Add -emit-llvm to test/Driver/fsanitize.c to stop this failing on the ARM bot. Approved by d0k.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169088 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 12:15:28 +00:00
Eli Friedman 19c8ce0cf5 Try to make the source location information for token pastes a bit more consistent.
Fixes a crash printing diagnostics on the gcc testsuite, and also makes
diagnostic range printing print nicer results for token pastes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169068 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:15:54 +00:00
Richard Smith 0565037864 Remove restriction on combining ubsan with asan or tsan. This has worked for a while.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169066 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:02:45 +00:00
Douglas Gregor 464a01a67c Fix the determination of whether a capture refers to an enclosing
scope when dealing with nested blocks. Fixes <rdar://problem/12778708>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169065 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 01:01:09 +00:00
Bill Wendling 6e6330c07a Don't emit a warning with an input/output parameter. We assume the user knows what they're doing here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169059 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:46:56 +00:00
Douglas Gregor 5a98f1da0e Fix test for Windows path separators
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169058 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:40:49 +00:00
Douglas Gregor 14afab36c7 Teach the serialized diagnostic writer to clone() itself, sharing
state so that all of the various clones end up rendering their
diagnostics into the same serialized-diagnostics file. This is
important when we actually want failures during module build to be
reported back to the translation unit that tried to import the
not-yet-built or out-of-date module. <rdar://problem/12565727>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169057 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:32:31 +00:00
Bill Wendling e2dbaa9f78 Don't warn if the input size is less than the register size. Also don't warn if
the output size is greater than the register size. No truncation occurs with
those. Reword warning to make it clearer what's the problem is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169054 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:18:12 +00:00
Eli Friedman d87de7bdbc Make -Wtautological-constant-out-of-range-compare behave sanely for enums with a signed fixed type.
<rdar://problem/12780159>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169051 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 23:09:29 +00:00
Douglas Gregor 6c3254316d When we're emitting a diagnostic with a source location in an imported
module, provide a module import stack similar to what we would get for
an include stack, e.g.,

In module 'DependsOnModule' imported from build-fail-notes.m:4:
In module 'Module' imported from DependsOnModule.framework/Headers/DependsOnModule.h:1:
Inputs/Module.framework/Headers/Module.h:15:12: note: previous definition is here
@interface Module

<rdar://problem/12696425>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169042 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 21:58:49 +00:00
Aaron Ballman fafd101e6b Support for #pragma region/endregion for MSVC compatibility. Patch thanks to pravic!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169028 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 19:52:30 +00:00
Douglas Gregor 830ea5b7c7 When an error occurs while building a module on demand, provide "While
building module 'Foo' imported from..." notes (the same we we provide
"In file included from..." notes) in the diagnostic, so that we know
how this module got included in the first place. This is part of
<rdar://problem/12696425>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169021 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 18:38:50 +00:00
Eli Friedman ecdc8d3e0f Fix the computation of highlight ranges so we produce something sane when
the beginning and end of the range are in different macro arguments.
PR14399.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168984 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 06:19:40 +00:00
Quentin Colombet e5965df287 Add a test case for the new cortex-a5 switch
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168968 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 01:34:36 +00:00
Douglas Gregor 463d90986e Keep track of modules that have failed to build. If we encounter an
import of that module elsewhere, don't try to build the module again:
it won't work, and the experience is quite dreadful. We track this
information somewhat globally, shared among all of the related
CompilerInvocations used to build modules on-the-fly, so that a
particular Clang instance will only try to build a given module once.

Fixes <rdar://problem/12552849>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168961 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:55:25 +00:00
Eli Friedman db748a380a Fix a small calling-convention bug for x86-32. PR14453.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168959 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 23:21:04 +00:00
Alexey Samsonov 4d1a6e41e1 This patch exposes to Clang users three more sanitizers are experimental features of ASan:
1) init-order sanitizer: initialization-order checker.
Status: usable, but may produce false positives w/o proper blacklisting.
2) use-after-return sanitizer
Status: implemented, but heavily understed.
Should be optional, as it significanlty slows program down.
3) use-after-scope sanitizer
Status: in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168950 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 22:36:21 +00:00
Eli Bendersky 2ec5f551cc Make the test less sensitive to DWARF emission implementation details.
Note: the ":" goes into the regex because FileCheck wrongly complains about
unbalanced brackets otherwise.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168934 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 20:01:14 +00:00
Eric Christopher 6716d9443d Make sure that we put the rest of the sanitizer libraries on the link line
before libstdc++ like we do with ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 18:51:05 +00:00
Eric Christopher 1fadc0e17a Use newer command line option here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168908 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 18:08:24 +00:00
Eric Christopher 4f000c34db Remove duplicate test run lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168907 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 18:08:22 +00:00
Rafael Espindola 8b8a09e496 Merge function types in C.
Among other differences, GCC accepts

  typedef int IA[];
  typedef int A10[10];
  static A10 *f(void);
  static IA  *f(void);
  void g(void) {
    (void)sizeof(*f());
  }

but clang used to reject it with:

  invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []')

The intention of c99's 6.2.7 seems to be that we should use the composite type
and accept as gcc does.

Doing the type merging required some extra fixes:
  * Use the type from the function type in initializations, even if an parameter
    is available.
  * Fix the merging of the noreturn attribute in function types.
  * Make CodeGen  handle the fact that an parameter type can be different from
    the corresponding type in the function type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168895 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 16:09:03 +00:00
Timur Iskhodzhanov 53c61c5c0c [-cxx-abi microsoft] Also spill the argument-back-references context when mangling templates
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 08:58:47 +00:00
Richard Smith 8426890494 Reject uses of __int128 on platforms that don't support it. Also move the ugly
'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be
properly cleaned up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 05:41:51 +00:00
Eli Friedman a70779f6b9 Fix crash-on-invalid. <rdar://problem/12765391>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168851 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 03:13:49 +00:00
Richard Smith afb49189d6 The declaration of a special member can require overload resolution to be
performed, to determine whether that special member is deleted or constexpr.
That overload resolution process can in turn trigger the instantiation of a
template, which can do anything, including triggering the declaration of that
very same special member function. When this happens, do not try to recursively
declare the special member -- that's impossible. Instead, only try to realise
the truth. There is no special member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168847 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 01:34:07 +00:00
Ted Kremenek 9c0466603f Correctly handle IntegralToBool casts in C++ in the static analyzer. Fixes <rdar://problem/12759044>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168843 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:50:20 +00:00
Chad Rosier 586a061ad9 [driver] -mkernel implies -mstrict-align; don't add the redundant option.
rdar://12771737

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168841 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 00:42:06 +00:00
Michael Han 52b501cd72 Implement C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains to a friend declaration, that declaration shall be a definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 23:17:40 +00:00
Fariborz Jahanian b15c8984ea objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168825 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 23:12:17 +00:00
Richard Smith a70c3f8738 Per C++11 [except.spec]p2, rvalue references are not permitted in exception specifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168824 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:52:42 +00:00
Richard Smith 21173b1080 PR14388: An array or function type in an exception specification should be
decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and
additional testcases by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168822 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:33:28 +00:00
Manman Ren 060f34d6d1 ABI: comments from Eli on r168820.
rdar://12723368


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168821 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:29:41 +00:00
Manman Ren f51c61c78e ABI: modify CreateCoercedLoad and CreateCoercedStore to not use load or store of
the original parameter or return type.

Since we do not accurately represent the data fields of a union, we should not
directly load or store a union type.

As an exmple, if we have i8,i8, i32, i32 as one field type and i32,i32 as
another field type, the first field type will be chosen to represent the union.
If we load with the union's type, the 3rd byte and the 4th byte will be skipped.

rdar://12723368


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168820 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 22:08:52 +00:00
Richard Smith f641166066 PR13098: If we're instantiating an overloaded binary operator and we could
determine which member function would be the callee from within the template
definition, don't pass that function as a "non-member function" to
CreateOverloadedBinOp. Instead, just rely on it to select the member function
for itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168818 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 21:47:39 +00:00
Alexey Samsonov 3325b1617f Refactor -fsanitize, -f*-sanitizer arguments parsing. Provide a more careful diagnostic for invalid sets of sanitizers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168794 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 17:34:24 +00:00
Richard Smith 30cddaec99 Teach Lexer::getSpelling about raw string literals. Specifically, if a raw
string literal needs cleaning (because it contains line-splicing in the
encoding prefix or in the ud-suffix), do not clean the section between the
double-quotes -- that's the "raw" bit!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168776 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 07:29:00 +00:00
Richard Smith acf796b479 Store on the CXXRecordDecl whether the class has, or would have, a copy
constructor/assignment operator with a const-qualified parameter type. The
prior method for determining this incorrectly used overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168775 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 06:23:12 +00:00
Richard Smith b8abff66a8 C++ core issue 1344, PR10618: promote "addition of default argument makes this
a special member" diagnostic from warning to error, and fix the cases where it
produced diagnostics with incorrect wording.

We don't support this as an extension, and we ban it even in C++98 mode. This
breaks too much (for instance, the ABI-specified calling convention for a type
can change if it acquires a copy constructor through the addition of a default
argument).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168769 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 03:45:24 +00:00
Ted Kremenek 1994e3993e Fix another false positive due to a CXX temporary object appearing in a C initializer.
The stop-gap here is to just drop such objects when processing the InitListExpr.
We still need a better solution.

Fixes <rdar://problem/12755044>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-28 01:49:01 +00:00
Ted Kremenek bd8a11e224 Provide stop-gap solution to crash reported in PR 14436.
This was also covered by <rdar://problem/12753384>.  The static analyzer
evaluates a CXXConstructExpr within an initializer expression and
RegionStore doesn't know how to handle the resulting CXXTempObjectRegion
that gets created.  We need a better solution than just dropping the
value, but we need to better understand how to implement the right
semantics here.

Thanks to Jordan for his help diagnosing the behavior here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168741 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 23:05:37 +00:00
Fariborz Jahanian 82c458ea76 objective-C arc: load of a __weak object happens via call to
objc_loadWeak. This retains and autorelease the weakly-refereced
object. This hidden autorelease sometimes makes __weak variable alive even
after the weak reference is erased, because the object is still referenced
by an autorelease pool. This patch overcomes this behavior by loading a 
weak object via call to objc_loadWeakRetained(), followng it by objc_release
at appropriate place, thereby removing the hidden autorelease. // rdar://10849570


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168740 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 23:02:53 +00:00
Will Dietz b85403658a Add -fsanitize=integer for reporting suspicious integer behaviors.
Introduces new sanitizer "unsigned-integer-overflow".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 15:01:55 +00:00
Timur Iskhodzhanov 5e7b43ed30 Remove outdated FIXME; should have removed that in r160782
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168698 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 12:55:47 +00:00
NAKAMURA Takumi 93308b9aa4 clang/test/lit.cfg: Disable dev-fd-fs on cygwin for now.
open("/dev/fd/1-foobar") fails with EEXIST on cygwin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 05:25:41 +00:00
Eli Friedman 55f6c336b1 Test for r168674.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168675 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:58:49 +00:00
Bill Schmidt c9715fc7c3 This patch addresses an incompatibility relative to the 64-bit PowerPC
ELF ABI.

Complex values are to be passed in registers as though the real and
imaginary parts were passed as separate parameters.  Prior to this
patch, complex values were passed as byval aggregates.  It turns out
that specifying getDirect() for all complex types when classifying the
argument type results in the desired behavior.

The new Clang test case verifies that the correct LLVM IR is generated
for caller and callee for each of the underlying types for _Complex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168673 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:46:43 +00:00
Jordan Rose 6e99f9f56f [analyzer] Fix test to work on non-LP64 systems.
Thanks for the original catch in r168303, Takumi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168671 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 02:37:49 +00:00
Rafael Espindola ec351f169d Add a testcase that r168411 would break.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 01:56:54 +00:00
Daniel Dunbar acf36129fa Frontend: Create a virtual file for named pipe inputs.
- This ensures we see the right buffer size for the file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 00:04:16 +00:00
Michael Han 2e39713a3d Improve diagnostic on C++11 attribute specifiers that appear at wrong syntactic locations around class specifiers.
This change list implemented logic that explicitly detects several combinations of locations where C++11 attribute
specifiers might be incorrectly placed within a class specifier. Previously we emit generic diagnostics like 
"expected identifier" for such cases; now we emit specific diagnostic against the misplaced attributes, this also 
fixed a bug in old code where attributes appear at legitimate locations were incorrectly rejected.

Thanks to Richard Smith for reviewing!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 22:54:45 +00:00
Sebastian Pop 9e4bafc321 check that always_inline attribute works with -fno-inline
Clean up the existing test to use FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 20:44:46 +00:00