Commit Graph

42169 Commits

Author SHA1 Message Date
Edwin Vane 524741fbbd Style and Doc fix for CommonOptionsParser
- Renaming GetCompilations() and GetSourcePathList() to follow LLVM
  style.
- Updating docs to reflect name change.
- Also updating help text to not mention clang-check since this class
  can be used by any tool.

Reviewed By: Alexander Kornienko

llvm-svn: 170229
2012-12-14 18:58:25 +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
NAKAMURA Takumi 92eb254c3c [CMake] Move libxml2 stuff from clang to llvm/cmake.
llvm-svn: 170225
2012-12-14 18:30:20 +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
NAKAMURA Takumi 02f4395df6 Targets.cpp: [cygwin] Add the predefined macro "_X86_", according to newer version of cygwin/w32api.
llvm-svn: 170188
2012-12-14 10:17:26 +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
Argyrios Kyrtzidis 6fada2ddbd Remove code from Sema::ActOnStartOfFunctionTemplateDef that duplicates what
Sema::ActOnStartOfFunctionDef is already doing.

llvm-svn: 170179
2012-12-14 06:53:58 +00:00
Nico Weber b819108af7 fix another spello
llvm-svn: 170177
2012-12-14 02:41:18 +00:00
Nico Weber 696933606b fix spello
llvm-svn: 170176
2012-12-14 02:40:09 +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
Ted Kremenek 45bb8db372 Refactor dump methods to make RegionBindingsRef printable in the debugger.
llvm-svn: 170170
2012-12-14 01:23:13 +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
Argyrios Kyrtzidis 3960540e30 [PCH] Make the new PCH format (control block) backwards compatible and
don't crash when loading a PCH with the older format.

The introduction of the control block broke compatibility with PCHs from
older versions. This patch allows loading (and rejecting) PCHs from an older
version and allows newer PCHs to be rejected from older clang versions as well.

rdar://12821386

llvm-svn: 170150
2012-12-13 21:38:23 +00:00
Rafael Espindola 62e8770ff8 Add support for current Ubuntu Quantal and the upcoming Raring.
Patch by Martin Nowack.

llvm-svn: 170147
2012-12-13 20:26:05 +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
Jordan Rose 2806a549b4 [analyzer] Fix doc error (wrong param name) in ObjCSuperCallChecker.
Thanks for the -Wdocumentation catch, Dmitri!

llvm-svn: 170139
2012-12-13 18:26:05 +00:00
NAKAMURA Takumi 62167ca254 Update CMake build corresponding to r170135.
Thanks to Saleem Abdulrasool, aka compnerd!

llvm-svn: 170136
2012-12-13 16:24:59 +00:00
Roman Divacky d93c8c008e Dont use/link ARCMT, StaticAnalyzer and Rewriter to clang when the user
specifies not to. Dont build ASTMatchers with Rewriter disabled and
StaticAnalyzer when it's disabled.

Without all those three, the clang binary shrinks (x86_64) from ~36MB
to ~32MB (unstripped).

llvm-svn: 170135
2012-12-13 16:09:42 +00:00
Dmitri Gribenko 795774018e Documentation: add AutomaticReferenceCounting.rst to the toctree
llvm-svn: 170133
2012-12-13 16:06:00 +00:00
Dmitri Gribenko 6c48a8c4ee Documentation: convert AutomaticReferenceCounting.html to reST
Patch by Anastasi Voitova with with small fixes by me.

llvm-svn: 170132
2012-12-13 16:04:37 +00:00
Alexander Kornienko 18ec81b854 Rename StmtDumper to ASTDumper.
Patch contributed by Philip Craig!

llvm-svn: 170127
2012-12-13 13:59:55 +00:00
Guy Benyei 41aa1a4b92 Remove little endian specification from SPIR data layout - SPIR doesn't define endiannes in the data layout.
llvm-svn: 170125
2012-12-13 13:22:48 +00:00
Richard Smith bb741f4552 Point a hyperlink back to where it was before it got reStructured.
llvm-svn: 170110
2012-12-13 07:29:23 +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
Richard Smith f0480fc988 Simplify. No functionality change.
llvm-svn: 170100
2012-12-13 05:41:48 +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
Sean Silva bf9b4cd596 docs: More reST conversion.
Sorry for the large commit, but it is much faster to convert in batches.

llvm-svn: 170067
2012-12-13 01:10:46 +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
Sean Silva 709c44d1f1 docs: Convert some docs to reST.
Converts:
    LanguageExtensions
    LibASTMatchers
    LibTooling
    PCHInternals
    ThreadSanitizer
    Tooling

Patch by Mykhailo Pustovit!
(with minor edits by Dmitri Gribenko and Sean Silva)

llvm-svn: 170048
2012-12-12 23:44:55 +00:00
Daniel Dunbar e50a92f754 docs: Another test commit (sphinx autoupdating).
llvm-svn: 170047
2012-12-12 23:35:03 +00:00
Daniel Dunbar e6daf69f8b docs: Test commit (sphinx autoupdating).
llvm-svn: 170046
2012-12-12 23:33:24 +00:00
Sean Silva 99b51c48cc docs: Initial Sphinx setup for Clang.
I don't think this will be visible just yet on <clang.llvm.org/docs/>
since I don't think that the necessary server-side setup has taken
place.

Don't shoot me over the theme. I don't want to duplicate LLVM's theme
into the clang repo at the moment, so I just used one of Sphinx's
default themes.

llvm-svn: 170042
2012-12-12 23:02:30 +00:00
Argyrios Kyrtzidis 1f7321677c [arcmt] When capturing ARC errors, have a sanity check to make sure
the diagnostic has a valid location.

llvm-svn: 170040
2012-12-12 22:48:28 +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
Chad Rosier 86b82087de [driver] Don't warn about an unused -flto option.
rdar://12851905

llvm-svn: 170010
2012-12-12 20:06:31 +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
Benjamin Kramer adaf795fc9 PR14581: Make SourceLocation::printToString work, or it will always return an empty string.
No test case, this is debugging code.

llvm-svn: 169980
2012-12-12 14:17:17 +00:00
Manuel Klimek 5704e4e91c Speeds up parsing of global declarations in cases where the warning
is switched of by about 0.8% (tested with int i<N>).

Additionally, this puts computing the diagnostic class into the hot
path more when parsing, in preparation for upcoming optimizations
in this area.

llvm-svn: 169976
2012-12-12 13:26:54 +00:00
NAKAMURA Takumi ad80c5ef76 clang/lib/Driver/Driver.cpp: Split COMPILER_PATH according to llvm::sys::PathSeparator, that is ';' in Win32 hosts.
Thanks to Bogon Kim!

llvm-svn: 169964
2012-12-12 06:22:22 +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
Benjamin Kramer 256f1dd0fc Speed up looking up static diagnostic infos.
Instead of doing a binary search over the whole diagnostic table (which weighs
a whopping 48k on x86_64), use the existing enums to compute the index in the
table. This avoids loading any unneeded data from the table and avoids littering
CPU caches with it. This code is in a hot path for code with many diagnostics.

1% speedup on -fsyntax-only gcc.c, which emits a lot of warnings.

llvm-svn: 169890
2012-12-11 18:00:22 +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
Matt Beaumont-Gay 9728393555 Fix a copypasto bug. Also rename the parameter in question to not shadow the
'file' builtin, and fix up a docstring a little.

Hat tip to Sebastian Kreft Carreno at Google for noticing the bug.

llvm-svn: 169887
2012-12-11 17:37:46 +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
Alexander Kornienko 61c93bdf77 StmtDumper coding style changes
Summary:
A few small coding style changes for StmtDumper, including:
- rename Dump* methods to dump*
- uninline some methods
- comment fixes
- whitespace fixes

Please review and commit if okay.

Reviewers: alexfh

Reviewed By: alexfh

CC: cfe-commits, alexfh, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D190

llvm-svn: 169866
2012-12-11 15:28:09 +00:00
Alexander Kornienko 7bd0f9be94 Rename StmtDumper::DumpSubTree() to dumpStmt()
Summary:
Also rename DumpDeclarator() to dumpDecl(). Once Decl dumping is added, these will be the two main methods of the class, so this is just for consistency in naming.

There was a DumpStmt() method already, but there was no point in having it, so I have merged it into VisitStmt(). Similarly, DumpExpr() is merged into VisitExpr().

Reviewers: alexfh

Reviewed By: alexfh

CC: cfe-commits, alexfh

Differential Revision: http://llvm-reviews.chandlerc.com/D156

llvm-svn: 169865
2012-12-11 15:20:44 +00:00
Argyrios Kyrtzidis 3b7793797f Extend stat query APIs to explicitly specify if the query is for
a file or directory, allowing just a stat call if a file descriptor
is not needed.

Doing just 'stat' is faster than 'open/fstat/close'.
This has the effect of cutting down system time for validating the input files of a PCH.

llvm-svn: 169831
2012-12-11 07:48:23 +00:00
Argyrios Kyrtzidis 53c3877f94 [PCH] Remove redundant stat call when validating the input files.
This became redundant after we removed the stat cache.

llvm-svn: 169830
2012-12-11 07:48:14 +00:00
Argyrios Kyrtzidis e65856fe60 [PCH] When writing out the list of input files, avoid emitting duplicate
entries of the same file.

This can happen because the file was "included" multiple times and is
referenced by multiple SLocEntries.

llvm-svn: 169829
2012-12-11 07:48:08 +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
NAKAMURA Takumi 24fa47b541 BackendUtil.cpp: Add #include "llvm/TargetTransformInfo.h"
llvm/Target/TargetMachine.h will not provide "llvm/TargetTransformInfo.h" any more.

llvm-svn: 169816
2012-12-11 05:53:24 +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 5897974488 Add support to Darwin for the -export_dynamic' flag to the linker.
llvm-svn: 169775
2012-12-10 21:48:41 +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
Daniel Jasper a4396865d0 Addi formatting tests for pointer template parameters.
Fix spacing before ",".

llvm-svn: 169746
2012-12-10 18:59:13 +00:00
Michael Ilseman 43e17ad1d0 Remove unneeded typedef and volatile
llvm-svn: 169743
2012-12-10 18:48:08 +00:00
Alexander Kornienko 2ca766f32a Clang-format: error recovery for access specifiers
Reviewers: klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D198

llvm-svn: 169738
2012-12-10 16:34:48 +00:00
Manuel Klimek dd1ff5ece0 Clarifying comments for the MatchFinder and matchesNames matcher.
llvm-svn: 169737
2012-12-10 16:13:06 +00:00
Manuel Klimek e792efd7ba Adding tests since when I was asked whether this works I wasn't
100% sure.

llvm-svn: 169725
2012-12-10 07:08:53 +00:00
Benjamin Kramer 7464efcac8 Unbreak the clang build after r169712.
llvm-svn: 169713
2012-12-09 21:58:24 +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 ed72cdc010 Cleanup and fix an assert that was mis-firing.
Note that there is no test suite update. This was found by a couple of
tests failing when the test suite was run on a powerpc64 host (thanks
Roman!). The tests don't specify a triple, which might seem surprising
for a codegen test. But in fact, these tests don't even inspect their
output. Not at all. I could add a bunch of triples to these tests so
that we'd get the test coverage for normal builds, but really someone
needs to go through and add actual *tests* to these tests. =[ The ones
in question are:

  test/CodeGen/bitfield-init.c
  test/CodeGen/union.c

llvm-svn: 169694
2012-12-09 10:33:27 +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
Richard Smith 1a2532b3fe Remove some remnants of the assumption that there is at most one of each
flavour of special member.

llvm-svn: 169670
2012-12-08 04:10:18 +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
Argyrios Kyrtzidis 222a7bbf0d [Preprocessor] Enhance Ifdef/Ifndef/Defined preprocessor callbacks to also pass
a MacroInfo object if the identifier was a macro name.

llvm-svn: 169665
2012-12-08 02:21:11 +00:00
Richard Smith 189aba9305 Add a FIXME.
llvm-svn: 169664
2012-12-08 02:13:02 +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
Eli Bendersky f6f93ee31c Currently when AST record layouts are dumped with -fdump-record-layouts, the
following:

sizeof=132, dsize=132, align=4
nvsize=132, nvalign=4

Is not indented, so when classes are nested there is no way to know to
which class it belongs.

Fix this problem by indenting the size summary properly for each class.

llvm-svn: 169654
2012-12-08 00:07:24 +00:00
Bill Wendling 3087d026da s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future.
llvm-svn: 169652
2012-12-07 23:17:26 +00:00
DeLesley Hutchins 8ecd491e75 Fix analysis based warnings so that all warnings are emitted when compiling
with -Werror.  Previously, compiling with -Werror would emit only the first
warning in a compilation unit, because clang assumes that once an error occurs,
further analysis is unlikely to return valid results.  However, warnings that
have been upgraded to errors should not be treated as "errors" in this sense.

llvm-svn: 169649
2012-12-07 22:53:48 +00:00
Matt Beaumont-Gay 05e0ad5961 Appease -Wnon-virtual-dtor
llvm-svn: 169648
2012-12-07 22:49:27 +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 9cadaa7ef8 [analyzer] Rename the option help to reflect better what it does.
llvm-svn: 169640
2012-12-07 21:51:50 +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
Daniel Jasper 4ec32d3d90 AST matcher tutorial (Part I)
This an AST matcher tutorial based on Sam Panzer's document
(https://docs.google.com/a/google.com/document/d/1oTkVLhCdRJUEH1_LDaQdXqe8-aOqT5GLDL9e4MhoFF8/edit).

Checking in now although some parts might be a bit rough so others can
help improving it.

llvm-svn: 169632
2012-12-07 20:34:49 +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
Ted Kremenek 54c9a4fad1 Reduce conversions between Store <-> ImmutableMapRef in RegionStore.
This reduces canonicalization of ImmutableMaps.  This reduces analysis time
of one heavy Objective-C file by another 1%.

llvm-svn: 169630
2012-12-07 19:54:25 +00:00
Ted Kremenek 897702e30a Add helper method to convert from a RegionStoreRefBindings to a Store.
llvm-svn: 169622
2012-12-07 18:32:08 +00:00
Matthew Curtis e5df381201 Hexagon TC: forward appropriate args to assembler
llvm-svn: 169611
2012-12-07 17:23:04 +00:00
NAKAMURA Takumi 55c128995b Driver/ToolChains.cpp: Add the name CentOS5 32bit gcc44 (aka i386-redhat-linux6E).
Thanks to Bruce Stephens.

llvm-svn: 169610
2012-12-07 17:13:18 +00:00
Alexander Kornienko e327684b2a Clang-format: extracted FormatTokenSource from UnwrappedLineParser.
Summary: FormatTokenLexer is here, FormatTokenBuffer is on the way. This will allow to re-parse unwrapped lines when needed.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D186

llvm-svn: 169605
2012-12-07 16:15:44 +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
Daniel Jasper 2723403f9e Small tweaks to clang-format.
Now not joining keywords with '::' and not putting a space between
a pointer pointer.

llvm-svn: 169594
2012-12-07 09:52:15 +00:00
Ted Kremenek 245e45af7d Cache queries to lookupPrivateMethod() within ObjCMethodCall::getRuntimeDefinition().
The same queries can happen thousands of times.  This reduces the analysis
time on one heavy Objective-C file by 2.4%.

llvm-svn: 169589
2012-12-07 07:30:19 +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
Ted Kremenek f19db16b0e Further reduce analysis time by 0.2% on a heavy Objective-C example by avoiding over-eager canonicalization of clusters.
llvm-svn: 169586
2012-12-07 06:49:27 +00:00
David Blaikie b006d38476 Unbreak the GCC (4.4 & other bot) builds from r169571.
llvm-svn: 169581
2012-12-07 03:28:20 +00:00
Richard Smith c2f865e8e5 Add file missed from r169574!
llvm-svn: 169576
2012-12-07 02:26:01 +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
Ted Kremenek 147784fdf2 Change RegionStore to always use ImmutableMapRef for processing cluster bindings.
This reduces analysis time by 1.2% on one test case (Objective-C), but
also cleans up some of the code conceptually as well.  We can possible
just make RegionBindingsRef -> RegionBindings, but I wanted to stage
things.

After this, we should revisit Jordan's optimization of not canonicalizing
the immutable AVL trees for the cluster bindings as well.

llvm-svn: 169571
2012-12-07 01:55:21 +00:00
Jordan Rose d40d321bcd [analyzer] Remove possible pessimizations from r169563.
Thanks for reminding me about copy-elision, David. Passing references here
doesn't help when we could get move construction in C++11. If we really
cared, we'd use std::swap to steal the reference from the temporary arg,
but it's probably not /that/ critical outside of Profile anyway.

llvm-svn: 169570
2012-12-07 01:54:38 +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
Jordan Rose 6c4e70817c [analyzer] Avoid ProgramStateRef copy constructors.
Suggested by David Blaikie. ExplodedNode, CallEvent, and CheckerContext all
hang onto their ProgramState, so the accessors can return a reference to the
internal state rather than preemptively copying it. This helps avoid
temporary ProgramStateRefs, though local variables will still (correctly)
do an extra retain and release.

llvm-svn: 169563
2012-12-06 23:55:34 +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
Richard Smith 39dd38c061 Add extra truthiness.
llvm-svn: 169555
2012-12-06 22:40:09 +00:00
Fariborz Jahanian 19cd502a1d Fixes Makefile for Format unit tests.
llvm-svn: 169554
2012-12-06 22:29:01 +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
Benjamin Kramer bb09cb6433 Simplify PDiag's move assignment overload a bit, the self-move check isn't actually necessary.
This just empties out the diag, which is fine.

llvm-svn: 169542
2012-12-06 20:12:03 +00:00
Argyrios Kyrtzidis 8c1e667b7b Make sure to initialize the HasSkippedBody bit.
llvm-svn: 169540
2012-12-06 19:41:23 +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
Ted Kremenek cb95a8fd20 Revert "[analyzer] Aggressively cut back on the canonicalization in RegionStore."
Jordan and I discussed this, and we are going to do this another way.

llvm-svn: 169538
2012-12-06 19:40:32 +00:00
Benjamin Kramer bba0a95373 Add move semantics to PartialDiagnostic, which can be very expensive to copy.
llvm-svn: 169535
2012-12-06 19:09:30 +00:00
Matthew Curtis c91f0be499 Un-XFAIL hexagon-toolchain.c test for mingw32
llvm-svn: 169533
2012-12-06 19:03:09 +00:00
Argyrios Kyrtzidis 1eb71a1ba7 Add a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a body
that was skipped by the parser.

llvm-svn: 169531
2012-12-06 18:59:10 +00:00
Jordan Rose b10aae3fec [analyzer] Remove isa<> followed by dyn_cast<>.
llvm-svn: 169530
2012-12-06 18:58:29 +00:00
Jordan Rose 642e063838 [analyzer] Remove unused fields from ExprEngine.
'currStmt', 'CleanedState', and 'EntryNode' were being set, but only ever
used locally.

llvm-svn: 169529
2012-12-06 18:58:26 +00:00