Commit Graph

16800 Commits

Author SHA1 Message Date
Meador Inge b97878a235 CodeGen: Expand creal and cimag into complex field loads
PR 14529 was opened because neither Clang or LLVM was expanding
calls to creal* or cimag* into instructions that just load the
respective complex field.  After some discussion, it was not
considered realistic to do this in LLVM because of the platform
specific way complex types are expanded.  Thus a way to solve
this in Clang was pursued.  GCC does a similar expansion.

This patch adds the feature to Clang by making the creal* and
cimag* functions library builtins and modifying the builtin code
generator to look for the new builtin types.

llvm-svn: 170455
2012-12-18 20:58:04 +00:00
Guy Benyei d8a08ea98d Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

llvm-svn: 170432
2012-12-18 14:38:23 +00:00
Guy Benyei 11169dded0 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
llvm-svn: 170431
2012-12-18 14:30:41 +00:00
Guy Benyei b13abb952a Add OpenCL images as clang builtin types.
llvm-svn: 170428
2012-12-18 12:30:03 +00:00
NAKAMURA Takumi 7174e90078 test/Misc/dev-fd-fs.c: Mark this as XFAIL:freebsd (since r169831).
I don't want to suppress this to be excluded with the feature "dev-fd-fs". This should work also on freebsd.

llvm-svn: 170411
2012-12-18 05:14:30 +00:00
Rafael Espindola 74a133fa9a Merge storage classes even when contexts don't match.
This fixes the storage class of extern decls that are merged with file level
statics. The patch also fixes the linkage computation so that they are
considered internal.

llvm-svn: 170406
2012-12-18 04:18:55 +00:00
Rafael Espindola 8522ba845f Now that the uninitialized variable has been fixed in llvm, add this test back,
but remove unneeded options and fix the comment.

llvm-svn: 170405
2012-12-18 03:54:29 +00:00
Eli Friedman 52f32b9b2b The underlying type for an enum should be an integer type, not another enum.
(This change only affects ObjC.)

<rdar://problem/12857117>.

llvm-svn: 170402
2012-12-18 02:37:32 +00:00
Anders Carlsson 2a45e409a8 When warning about a missing prototype because a function declaration is missing 'void', insert a fixit to add the void.
llvm-svn: 170399
2012-12-18 01:29:20 +00:00
Eli Friedman 672845bcde More conservative fix for <rdar://problem/12847524> (a crash printing diagnostic ranges).
I'm not really happy with this fix, but I'm confident it's correct.

llvm-svn: 170397
2012-12-18 00:52:36 +00:00
Eric Christopher 45f2e71571 Add support for passing the main file name down to the assembler
for location information.

Part of PR14624

llvm-svn: 170391
2012-12-18 00:31:10 +00:00
Richard Smith be024a8150 Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
to an object outside its lifetime does not have undefined behavior.

llvm-svn: 170387
2012-12-18 00:22:45 +00:00
Rafael Espindola 7581f3269a Fix isThisDeclarationADefinition for extern following tentative.
An extern declaration following a tentative definition should not itself be
considered a tentative definition.
Fixes pr14614.

llvm-svn: 170377
2012-12-17 22:23:47 +00:00
Chandler Carruth 4d5e1a9b34 Fix PR14625 by teaching the driver to detect PWD for assembly files.
This also requires adding support to -cc1as for passing the detecting
PWD down through LLVM's debug info (which in turn required the LLVM
change in r170371).

The test case is weak (we only test the driver behavior) because there
is currently to infrastructure for running cc1as in the test suite. So
those four lines are untested (much like all other lines in that file),
but we have a test for the same pattern using llvm-mc in the LLVM
repository.

llvm-svn: 170373
2012-12-17 21:40:04 +00:00
Anna Zaks ad3704c96a [analyzer] Tweak the NumFunctionsAnalyzed stat so that it's more useful.
llvm-svn: 170362
2012-12-17 20:08:54 +00:00
Anna Zaks d53182b0df [analyzer] Implement "do not inline large functions many times"
performance heuristic

After inlining a function with more than 13 basic blocks 32 times, we
are not going to inline it anymore. The idea is that inlining large
functions leads to drastic performance implications. Since the function
has already been inlined, we know that we've analyzed it in many
contexts. 

The following metrics are used:
 - Large function is a function with more than 13 basic blocks (we
should switch to another metric, like cyclomatic complexity)
 - We consider that we've inlined a function many times if it's been
inlined 32 times. This number is configurable with -analyzer-config
max-times-inline-large=xx

This heuristic addresses a performance regression introduced with
inlining on one benchmark. The analyzer on this benchmark became 60
times slower with inlining turned on. The heuristic allows us to analyze
it in 24% of the time. The performance improvements on the other
benchmarks I've tested with are much lower - under 10%, which is
expected.

llvm-svn: 170361
2012-12-17 20:08:51 +00:00
David Chisnall 0d75e0600b Reapply r170344, this time without forgetting to commit the header changes.
llvm-svn: 170354
2012-12-17 18:54:24 +00:00
Benjamin Kramer beea120d6e Revert "Added support for new property helpers (GNUstep runtime)."
This reverts commit r170344. Doesn't even compile.

llvm-svn: 170351
2012-12-17 18:02:43 +00:00
David Chisnall e99bc83fa5 Added support for new property helpers (GNUstep runtime).
llvm-svn: 170344
2012-12-17 15:59:29 +00:00
Dmitry Vyukov a53767ea22 tsan: add __has_feature(thread_sanitizer)
llvm-svn: 170314
2012-12-17 08:52:05 +00:00
Bill Schmidt a3d121cd61 This patch fixes PR13624, which notes a 64-bit PowerPC ELF ABI
incompatibility with how complex values are returned.  It is sufficient
to flag all complex types as direct rather than indirect.

A new test case is provided that checks correct IR generation for the
various supported flavors of _Complex.

llvm-svn: 170302
2012-12-17 04:20:17 +00:00
Will Dietz ddd282addb [ubsan] Emit branch weight metadata to hint towards common case.
Results in better block placement that helps close the
performance gap when making ubsan checks recoverable.

llvm-svn: 170263
2012-12-15 01:39:14 +00:00
Argyrios Kyrtzidis 53e3d6d7f0 Don't hit an assertion failure when calculating the __PRETTY_FUNCTION__
of a member function with parenthesized declarator.

Like this test case:

class Foo {
  const char *(baz)() {
    return __PRETTY_FUNCTION__;
  }
};

llvm-svn: 170233
2012-12-14 19:44:11 +00:00
Argyrios Kyrtzidis 164fdb607b [preprocessor] For errors at a function macro invocation, also include
a note about where the macro is defined.

llvm-svn: 170228
2012-12-14 18:53:47 +00:00
Nico Weber 7aa4a881e6 Don't require a space between the two ">" in "vector<id<protocol>>" in objc++11.
C++11 allowed writing "vector<vector<int>>" without a space between the two ">".
This change allows this for protocols in template lists too in -std=c++11 mode,
and improves the diagnostic in c++98 mode.

llvm-svn: 170223
2012-12-14 18:22:38 +00:00
Argyrios Kyrtzidis 26444c5243 Have Sema::ActOnStartOfFunctionDef return the declaration that was passed it.
This fixes the missing warning here:

struct S {
    template <typename T>
    void meth() {
        char arr[3];
        arr[4] = 0; // warning: array index 4 is past the end of the array
    }
};

template <typename T>
void func() {
    char arr[3];
    arr[4] = 0; // no warning
}

llvm-svn: 170180
2012-12-14 06:54:03 +00:00
NAKAMURA Takumi 6780b68ff5 clang/test/CodeGenCXX/lambda-expressions.cpp: Relax expression for -Asserts.
"entry:" is not met in -Asserts build.

llvm-svn: 170175
2012-12-14 02:35:04 +00:00
Nadav Rotem a633af3f68 Make the test less sensitive to the inline threshold.
llvm-svn: 170164
2012-12-14 00:26:15 +00:00
Eli Friedman f5f4d2fd2e Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>
llvm-svn: 170160
2012-12-13 23:37:17 +00:00
David Blaikie 831c9927e8 Debug Info: Emit vtables pointer members as artificial.
I wasn't sure where to put the test case for this, but this seemed like as good
a place as any. I had to reorder the tests here to make them legible while
still matching the order of metadata output in the IR file (for some reason
making it virtual changed the ordering).

Relevant commit to fix up LLVM to actually respect 'artificial' member
variables is coming once I write up a test case for it.

llvm-svn: 170154
2012-12-13 22:29:06 +00:00
Nadav Rotem b89373430a Revert 170049 because it fails with an assertion on one of the spec2000 workloads.
llvm-svn: 170143
2012-12-13 19:58:10 +00:00
Richard Smith 1629da95fe ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.

llvm-svn: 170108
2012-12-13 07:11:50 +00:00
Rafael Espindola 0f207edaa5 Initial support for FreeBSD on ARM.
Patch by Andrew Turner.

llvm-svn: 170096
2012-12-13 04:17:14 +00:00
Jordan Rose b0fe7fdb57 [analyzer] Generalize ObjCMissingSuperCallChecker.
We now check a few methods for UIResponder, NSResponder, and NSDocument.

Patch by Julian Mayer!

llvm-svn: 170089
2012-12-13 03:06:45 +00:00
Eli Friedman 07bab73c7f Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced.  <rdar://problem/12858424>.

llvm-svn: 170081
2012-12-13 01:43:21 +00:00
Anna Zaks 3f12949b25 [analyzer] Fix a self-init checker false positive.
This is a Band-Aid fix to a false positive, where we complain about not
initializing self to [super init], where self is not coming from the
init method, but is coming from the caller to init.

The proper solution would be to associate the self and it's state with
the enclosing init.

llvm-svn: 170059
2012-12-13 00:42:19 +00:00
Fariborz Jahanian b487388be1 objc: DOn't complain if a (SEL) expression is typecast
to (SEL). Fixes // rdar://12859590

llvm-svn: 170058
2012-12-13 00:42:06 +00:00
Eli Friedman 89a4a2cd3d Add missing check for error return from DefaultLvalueConversion. Fixes <rdar://problem/12857416>.
llvm-svn: 170056
2012-12-13 00:37:17 +00:00
Eli Friedman cdb135a96b More hacking on mapDiagnosticRanges to make it handle more cases.
This still isn't quite right, but it fixes a crash.

I factored out findCommonParent because we need it on the result of 
getImmediateExpansionRange: for a function macro, the beginning
and end of an expansion range can come out of different
macros/macro arguments, which means the resulting range is a complete
mess to handle consistently.

I also made some changes to how findCommonParent works; it works somewhat
better in some cases, and somewhat worse in others, but I think overall
it's a better balance.  I'm coming to the conclusion that mapDiagnosticRanges
isn't using the right algorithm, though: chasing the caret is fundamentally
more complicated than any algorithm which only considers one FileID for the
caret can handle because each SourceLocation doesn't really have a single parent.
We need to follow the same path of choosing expansion locations and spelling
locations which the caret used to come up with the correct range
in the general case.

Fixes <rdar://problem/12847524>.

llvm-svn: 170049
2012-12-13 00:14:59 +00:00
Argyrios Kyrtzidis f5b993f7b1 [objc] For the ARC error that is emitted when a synthesized property implementation
has inconsistent ownership with the backing ivar, point the error location to the
ivar.

Pointing to the ivar (instead of the @synthesize) is better since this is where a fix is needed.
Also provide the location of @synthesize via a note.

This also fixes the problem where an auto-synthesized property would emit an error without
any location.

llvm-svn: 170039
2012-12-12 22:48:25 +00:00
Chad Rosier 61b2f2bc9e [ms-inline asm] Test case for r170037.
llvm-svn: 170038
2012-12-12 22:46:23 +00:00
John McCall 49954ca014 Rewrite calls to bitcast unprototyped functions when emitting a definition.
My variadics patch, r169588, changed these calls to typically be
bitcasts rather than calls to a supposedly variadic function.
This totally subverted a hack where we intentionally dropped
excess arguments from such calls in order to appease the inliner
and a "warning" from the optimizer.  This patch extends the hack
to also work with bitcasts, as well as teaching it to rewrite
invokes.

llvm-svn: 170034
2012-12-12 22:21:47 +00:00
Jordan Rose 4cfdbff3c7 [analyzer] Don't crash running destructors for multidimensional arrays.
We don't handle array destructors correctly yet, but we now apply the same
hack (explicitly destroy the first element, implicitly invalidate the rest)
for multidimensional arrays that we already use for linear arrays.

<rdar://problem/12858542>

llvm-svn: 170000
2012-12-12 19:13:44 +00:00
Chad Rosier 13799b323e Marking the objc_autoreleaseReturnValue and objc_retainAutoreleaseReturnValue
call sites as tail calls unconditionally.  While it's theoretically true that
this is just an optimization, it's an optimization that we very much want to
happen even at -O0, or else ARC applications become substantially harder to
debug.  See r169796 for the llvm/fast-isel side of things.
rdar://12553082

llvm-svn: 169996
2012-12-12 17:52:21 +00:00
Richard Smith 181879c293 Don't warn about disabled macro expansion if we see the name of a function-like macro which isn't immediately followed by '('. FreeBSD's stdio.h #defines foo(x) to (foo)(x), apparently.
llvm-svn: 169960
2012-12-12 02:46:14 +00:00
Argyrios Kyrtzidis 12023e1ec3 [libclang] Make sure tokens from preprocessor directives are annotated as such,
even if the directive is inside a declaration.

Fixes rdar://11548788 & http://llvm.org/PR12970

llvm-svn: 169949
2012-12-12 01:05:25 +00:00
Richard Trieu 29a2ffc7aa Fix line ending is tests. No functional change.
llvm-svn: 169947
2012-12-12 00:52:15 +00:00
NAKAMURA Takumi e981508811 clang/test: Suppress two tests on win32 for now, since, not sure, in r169829 to r169831.
"ansi-escape-sequences" is easy convenient to exclude win32. Please be patient.

llvm-svn: 169945
2012-12-12 00:51:38 +00:00
Douglas Gregor 16ba5ff712 Try to fix Win32 failures
llvm-svn: 169923
2012-12-11 22:31:46 +00:00
Douglas Gregor 822627f8c5 Don't use 'touch' in this test; it may be the cause of Windows-related failures.
llvm-svn: 169922
2012-12-11 22:25:26 +00:00
Douglas Gregor c50d4924eb Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.

llvm-svn: 169919
2012-12-11 22:11:52 +00:00
Guy Benyei b798fc9849 Add SPIR32/SPIR64 targets to Clang
llvm-svn: 169917
2012-12-11 21:38:14 +00:00
Hal Finkel 061f1653e6 Add -fslp-vectorize to enable bb-vectorize
Add -fslp-vectorize (with -ftree-slp-vectorize as an alias for gcc compatibility)
to provide a way to enable the basic-block vectorization pass. This uses the same
acronym as gcc, superword-level parallelism (SLP), also common in the literature,
to refer to basic-block vectorization.

Nadav suggested this as a follow-up to the adding of -fvectorize.

llvm-svn: 169909
2012-12-11 19:59:32 +00:00
Fariborz Jahanian f762b72f35 objective-C blocks: Check for record type when deciding if
byref variable requires extended layout info. to prevent 
a crash involving arrays declared __block. // rdar://12787751

llvm-svn: 169908
2012-12-11 19:58:01 +00:00
Douglas Gregor c2e3d5cb29 Don't complain about incomplete implementations for methods that are
unavailable due to availability attributes. <rdar://problem/12798237>

llvm-svn: 169903
2012-12-11 18:53:07 +00:00
Chad Rosier 30797b2d7d [driver] Add the -ftree-vectorize flag as a alias of -fvectorize to maintain
compatibility with gcc.
rdar://12839978 

llvm-svn: 169888
2012-12-11 17:46:33 +00:00
Chad Rosier 0d3ed6f1c2 [driver] Add the -fvectorize flag to enable the loop vectorization passes.
rdar://12839978 

llvm-svn: 169885
2012-12-11 17:12:28 +00:00
NAKAMURA Takumi c174b4dbbf clang/test/Driver/linker-opts.c: Fix XFAIL that I removed win32.
Sorry for my 3rd commit :(

llvm-svn: 169827
2012-12-11 07:23:52 +00:00
NAKAMURA Takumi f8f4c9500e clang/test/Driver/debug-options-as.c: Fixup not to use prefix=S. I didn't know "REQUIRES:" would match --check-prefix=S ...
llvm-svn: 169826
2012-12-11 07:16:15 +00:00
NAKAMURA Takumi 556d713c70 clang/test/Driver: Introduce the feature "clang-driver", set if gcc driver is not used.
It is not set at targetting cygming. See PR12920.

llvm-svn: 169824
2012-12-11 07:06:09 +00:00
Rafael Espindola c720d46ed7 Add tests for a corner case of when to relax all instructions:
We don't want to relax all instructions in

$ clang -c test.s

since most users don't pass -O when using the driver to assemble.

On the other hand, -save-temps should not change the output unnecessary, so in

$ clang -c test.c -save-temps

we should relax all instructions.

llvm-svn: 169815
2012-12-11 05:52:24 +00:00
Richard Smith bd3051272c PR14558: Compute triviality of special members (etc) at the end of the class
definition, rather than at the end of the definition of the set of nested
classes. We still defer checking of the user-specified exception specification
to the end of the nesting -- we can't check that until we've parsed the
in-class initializers for non-static data members.

llvm-svn: 169805
2012-12-11 01:14:52 +00:00
Anna Zaks a7b1c47c1a [analyzer] Don't generate a summary for "freeWhenDone" if method is
inlined.

Fixes a false positive that occurs if a user writes their own
initWithBytesNoCopy:freeWhenDone wrapper.

llvm-svn: 169795
2012-12-11 00:17:53 +00:00
Bill Wendling 740629e299 Remove until I can fix this.
llvm-svn: 169778
2012-12-10 22:10:53 +00:00
Bill Wendling dcb992d474 Use correct flags for this test.
llvm-svn: 169768
2012-12-10 21:15:22 +00:00
Chad Rosier 99bde87178 Fixup test case from r169755. These are driver options, not frontend options.
Also, add the -S option.

llvm-svn: 169763
2012-12-10 20:16:17 +00:00
Argyrios Kyrtzidis 0d355df239 Return true from HeaderSearch::isFileMultipleIncludeGuarded if the file
was #import'ed.

llvm-svn: 169761
2012-12-10 20:08:37 +00:00
Bill Wendling 9a12912c9a Specify if `-mno-red-zone' was used when creating the GCOV instrucmentation pass.
This prevents the functions generated by that pass from using the red zone.
<rdar://problem/12843084>

llvm-svn: 169755
2012-12-10 19:47:53 +00:00
Michael Ilseman 43e17ad1d0 Remove unneeded typedef and volatile
llvm-svn: 169743
2012-12-10 18:48:08 +00:00
Aaron Ballman 02df2e0872 Virtual method overrides can no longer have mismatched calling conventions. This fixes PR14339.
llvm-svn: 169705
2012-12-09 17:45:41 +00:00
Chandler Carruth 6bb5c06e17 Add a triple to this test. It depends on little-endian bitfield layout.
llvm-svn: 169696
2012-12-09 10:39:18 +00:00
Chandler Carruth e8f7a95941 Add a test case that I've been using to clarify the bitfield layout for
both LE and BE targets.

AFAICT, Clang get's this correct for PPC64. I've compared it to GCC 4.8
output for PPC64 (thanks Roman!) and to my limited ability to read power
assembly, it looks functionally equivalent. It would be really good to
fill in the assertions on this test case for x86-32, PPC32, ARM, etc.,
but I've reached the limit of my time and energy... Hopefully other
folks can chip in as it would be good to have this in place to test any
subsequent changes.

To those who care about PPC64 performance, a side note: there is some
*obnoxiously* bad code generated for these test cases. It would be worth
someone's time to sit down and teach the PPC backend to pattern match
these IR constructs better. It appears that things like '(shr %foo,
<imm>)' turn into 'rldicl R, R, 64-<imm>, <imm>' or some such. They
don't even get combined with other 'rldicl' instructions *immediately
adjacent*. I'll add a couple of these patterns to the README, but
I think it would be better to look at all the patterns produced by this
and other bitfield access code, and systematically build up a collection
of patterns that efficiently reduce them to the minimal code.

llvm-svn: 169693
2012-12-09 10:08:22 +00:00
Chandler Carruth fd8eca202f Fix the bitfield record layout in codegen for big endian targets.
This was an egregious bug due to the several iterations of refactorings
that took place. Size no longer meant what it original did by the time
I finished, but this line of code never got updated. Unfortunately we
had essentially zero tests for this in the regression test suite. =[

I've added a PPC64 run over the bitfield test case I've been primarily
using. I'm still looking at adding more tests and making sure this is
the *correct* bitfield access code on PPC64 linux, but it looks pretty
close to me, and it is *worlds* better than before this patch as it no
longer asserts! =] More commits to follow with at least additional tests
and maybe more fixes.

Sorry for the long breakage due to this....

llvm-svn: 169691
2012-12-09 07:26:04 +00:00
Richard Smith 0db1ea5f68 Fix overload resolution for the initialization of a multi-dimensional
array from a braced-init-list. There seems to be a core wording wart
here (it suggests we should be testing whether the elements of the init
list are implicitly convertible to the array element type, not whether
there is an implicit conversion sequence) but our prior behavior appears
to be a bug, not a deliberate effort to implement the standard as written.

llvm-svn: 169690
2012-12-09 06:48:56 +00:00
Richard Smith f86b5dc700 PR14550: If a system header contains a bogus constexpr function definition,
don't mark the function as invalid, since we suppress the error.

llvm-svn: 169689
2012-12-09 05:55:43 +00:00
Richard Smith c88e40450d PR14549. Don't assert if we see an incomplete decltype specifier at the end of the file.
llvm-svn: 169688
2012-12-09 04:17:57 +00:00
Benjamin Kramer 2fec65d394 Escape % in the TextDiagnosticBuffer so they aren't interpreted twice when fed into the diagnostic formatting machinery again.
Fixes PR14543.

llvm-svn: 169677
2012-12-08 12:42:30 +00:00
David Chisnall a87d85994b long double should be 64 bits on FreeBSD/MIPS64. It possibly should be on
Linux too, as I think we inherited it from there.  The ABI spec says 128-bit,
although I think SGI's compiler on IRIX may be the only thing ever to support
this.

llvm-svn: 169674
2012-12-08 09:06:08 +00:00
Richard Smith 6b02d46dae Finish implementing 'selected constructor' rules for triviality in C++11. In
the cases where we can't determine whether special members would be trivial
while building the class, we eagerly declare those special members. The impact
of this is bounded, since it does not trigger implicit declarations of special
members in classes which merely *use* those classes.

In order to determine whether we need to apply this rule, we also need to
eagerly declare move operations and destructors in cases where they might be
deleted. If a move operation were supposed to be deleted, it would instead
be suppressed, and we could need overload resolution to determine if we fall
back to a trivial copy operation. If a destructor were implicitly deleted,
it would cause the move constructor of any derived classes to be suppressed.

As discussed on cxx-abi-dev, C++11's selected constructor rules are also
retroactively applied as a defect resolution in C++03 mode, in order to
identify that class B has a non-trivial copy constructor (since it calls
A's constructor template, not A's copy constructor):

struct A { template<typename T> A(T &); };
struct B { mutable A a; };

llvm-svn: 169673
2012-12-08 08:32:28 +00:00
DeLesley Hutchins 0cfa1a5a1d Thread-safety analysis: check member access on guarded non-primitive types.
llvm-svn: 169669
2012-12-08 03:46:30 +00:00
Richard Smith 92f241f188 Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.

llvm-svn: 169667
2012-12-08 02:53:02 +00:00
Argyrios Kyrtzidis f77b0f8886 [libclang] Resolve a cursor that points to a macro name inside a #ifdef/#ifndef
directive as a macro expansion.

This is more of a "macro reference" than a macro expansion but it's close enough
for libclang's purposes. If it causes issues we can revisit and introduce a new
kind of cursor.

llvm-svn: 169666
2012-12-08 02:21:17 +00:00
Richard Smith 593f993a68 Implement C++03 [dcl.init]p5's checking for value-initialization of references
properly, rather than faking it up by pretending that a reference member makes
the default constructor non-trivial. That leads to rejects-valids when putting
such types inside unions.

llvm-svn: 169662
2012-12-08 02:01:17 +00:00
Argyrios Kyrtzidis 23de34d6d6 [libclang] Declarations inside anonymous namespaces have internal linkage so
their USR should contain a location.

This uniques them from other declarations with the same name but in different translation units.
rdar://10546541

llvm-svn: 169647
2012-12-07 22:41:46 +00:00
Anna Zaks 5d484780fb [analyzer] Optimization heuristic: do not reanalyze every ObjC method as
top level.

This heuristic is already turned on for non-ObjC methods
(inlining-mode=noredundancy). If a method has been previously analyzed,
while being inlined inside of another method, do not reanalyze it as top
level.

This commit applies it to ObjCMethods as well. The main caveat here is
that to catch the retain release errors, we are still going to reanalyze
all the ObjC methods but without inlining turned on.

Gives 21% performance increase on one heavy ObjC benchmark, which
suffered large performance regressions due to ObjC inlining.

llvm-svn: 169639
2012-12-07 21:51:47 +00:00
Jordan Rose 9a33913645 [analyzer] Fix r168019 to work with unpruned paths as well.
This is the case where the analyzer tries to print out source locations
for code within a synthesized function body, which of course does not have
a valid source location. The previous fix attempted to do this during
diagnostic path pruning, but some diagnostics have pruning disabled, and
so any diagnostic with a path that goes through a synthesized body will
either hit an assertion or emit invalid output.

<rdar://problem/12657843> (again)

llvm-svn: 169631
2012-12-07 19:56:29 +00:00
Matthew Curtis e5df381201 Hexagon TC: forward appropriate args to assembler
llvm-svn: 169611
2012-12-07 17:23:04 +00:00
Matthew Curtis 6b22278aa7 Hexagon TC: add cc1 defaults for hexagon-gcc
compatibility

llvm-svn: 169599
2012-12-07 13:52:44 +00:00
John McCall c818bbb8b2 Fix the required args count for variadic blocks.
We were emitting calls to blocks as if all arguments were
required --- i.e. with signature (A,B,C,D,...) rather than
(A,B,...).  This patch fixes that and accounts for the
implicit block-context argument as a required argument.
In addition, this patch changes the function type under which
we call unprototyped functions on platforms like x86-64 that
guarantee compatibility of variadic functions with unprototyped
function types;  previously we would always call such functions
under the LLVM type T (...)*, but now we will call them under
the type T (A,B,C,D,...)*.  This last change should have no
material effect except for making the type conventions more
explicit;  it was a side-effect of the most convenient implementation.

llvm-svn: 169588
2012-12-07 07:03:17 +00:00
NAKAMURA Takumi 3f2f792673 clang/test: Remove "REQUIRES:LP64" in two tests. Each of them have explicit triple.
llvm-svn: 169587
2012-12-07 06:57:40 +00:00
Richard Smith 50d705b5b0 Per [dcl.fct.def.default]p1, don't allow variadic special members to be defaulted.
llvm-svn: 169574
2012-12-07 02:10:28 +00:00
NAKAMURA Takumi 3c114f81b6 test/Index/skip-parsed-bodies/compile_commands.json: Remove XFAIL on cygming.
llvm-svn: 169566
2012-12-07 00:05:36 +00:00
Logan Chien 48a353d339 Revert r169557. It seems that the test is too restricted
and will break the build on buildbot.

llvm-svn: 169562
2012-12-06 23:40:31 +00:00
Argyrios Kyrtzidis fc7f04510c [libclang] Add a test to make sure we skip bodies properly from "#pragma once" headers.
llvm-svn: 169558
2012-12-06 23:04:24 +00:00
Logan Chien 74aa8f1141 Add i686-linux-android for gcc toolchain detection.
* Look for i686-linux-android under <sysroot>/lib/gcc.

* This patch also slightly enhance the test suite for
  Android GCC toolchain detection.

llvm-svn: 169557
2012-12-06 22:59:37 +00:00
Matthew Curtis 4446bca53e hexagon-toolchain.c now passes on win32
llvm-svn: 169548
2012-12-06 21:25:18 +00:00
Matthew Curtis 1ece04413c relax hexagon-toolchain.c even more to accomodate mingw32 targets
llvm-svn: 169544
2012-12-06 20:55:41 +00:00
Matthew Curtis ed6f395c68 relax hexagon-toolchain.c CHECK to accomodate mingw32 targets
llvm-svn: 169543
2012-12-06 20:21:20 +00:00
Argyrios Kyrtzidis 8b71bc7d6b [libclang] Introduce a new indexing mode where we skip function bodies
that were already parsed in the same "indexing session".

An indexing session is defined as using the same CXIndexAction object
for multiple clang_indexSourceFile calls.
Passing CXIndexOpt_SkipParsedBodiesInSession as an indexing option will
enable the mode where we try to skip bodies that were already parsed in
another translation unit.

If a function's body was skipped, the "flags" field in the CXIdxDeclInfo
structure will have "CXIdxDeclFlag_Skipped" bit was set.

llvm-svn: 169539
2012-12-06 19:41:16 +00:00
Matthew Curtis c91f0be499 Un-XFAIL hexagon-toolchain.c test for mingw32
llvm-svn: 169533
2012-12-06 19:03:09 +00:00