Commit Graph

33977 Commits

Author SHA1 Message Date
Bob Wilson 1a9ad0fbee Search for libstdc++.dylib in llvm-gcc's files on darwin10. rdar://10419079
llvm-svn: 144381
2011-11-11 07:47:04 +00:00
NAKAMURA Takumi e89c3bd004 libclang/CXLoadedDiagnostic.cpp: Work around not to miss the string terminator on fixit.
FixIts might be exposed as C string via clang_getCString(), though the zero terminator is not allocated in CXLoadedDiagnosticSetImpl::makeString.

llvm-svn: 144379
2011-11-11 07:27:33 +00:00
Richard Smith 3ba71043dc Don't recurse so deep in this test, pending APValue rework to further reduce the
stack pressure.

llvm-svn: 144378
2011-11-11 07:10:32 +00:00
Richard Smith 6049446c47 Reduce the constexpr stack pressure somewhat. Hopefully this will be enough to
please the buildbots.

llvm-svn: 144375
2011-11-11 05:48:57 +00:00
NAKAMURA Takumi a5a032025b test/Misc/serialized-diags.c: Tweak FileCheck expressions to be tolerant to DOSish output.
FIXME: For now, " = 0Parse Issueexpected ';' after expression{{XXX}}" would not be matched due to unexpected garbage{{XXX} on some hosts.
llvm-svn: 144374
2011-11-11 05:12:45 +00:00
Richard Smith e97cbd7b3a Constant expression evaluation: support for constexpr member functions. This
reinstates r144273; a combination of r144333's fix for NoOp rvalue-to-lvalue
casts and some corresponding changes here resolve the regression which that
caused.

This patch also adds support for some additional forms of member function call,
along with additional testing.

llvm-svn: 144369
2011-11-11 04:05:33 +00:00
Ted Kremenek e8ffd1d48d Place 'argument unused during compilation' under a -W flag. Fixes <rdar://problem/10403653>.
llvm-svn: 144365
2011-11-11 03:58:21 +00:00
John McCall 03318c1dcf Don't apply NRVO to over-aligned variables. The caller only
guarantees alignment up to the ABI alignment of the return type.

llvm-svn: 144364
2011-11-11 03:57:31 +00:00
John McCall f1a3c2aee1 Be sure to insulate block literals from any cleanups in their
enclosing full-expressions.  It is somewhat amazing that 
this hasn't come up as a problem before.

llvm-svn: 144362
2011-11-11 03:19:12 +00:00
Eli Friedman 7771c835cd Add Linux multiarch include directories for mips/mipsel. Patch from Simon Atanasyan.
llvm-svn: 144358
2011-11-11 03:05:19 +00:00
NAKAMURA Takumi aacef7ea3c include/clang-c/Index.h: Update CINDEX_LINKAGE on 6 decls. Corresponds to libclang.exports in r144343
llvm-svn: 144357
2011-11-11 02:51:09 +00:00
Eli Friedman 4f64e1819b Make sure that restrict-qualifying an array actually adds a restrict qualifier. PR11354. (operator bool() is evil!)
llvm-svn: 144355
2011-11-11 02:00:42 +00:00
Ted Kremenek a0e32fc8b6 [serialized diagnostics]: add test cases for serialized diagnostics, including a test case for no issues, multiple issues, and
a single issue.  Along the way, tweak c-index-test -read-diagnostics output so it is easier to tell what diagnostics are
child diagnostics.

llvm-svn: 144349
2011-11-11 00:46:43 +00:00
Douglas Gregor 197ac203af I predict that HeaderSearch will need the ability to generate
diagnostics in the future. Make it so.

llvm-svn: 144347
2011-11-11 00:35:06 +00:00
Argyrios Kyrtzidis 7519c5e440 [libclang] Simplify the indexing API.
Cut down the number of callbacks to more generic ones. Clients can check
an enum to find out what kind of declaration it is and they can call functions
to get more specific information than the generic provided info.

llvm-svn: 144343
2011-11-11 00:23:36 +00:00
Argyrios Kyrtzidis 85b075b845 Add a const version of ObjCClassDecl::getForwardDecl, no functionality change.
llvm-svn: 144342
2011-11-11 00:23:31 +00:00
Francois Pichet f707ae6733 Move "Unqualified lookup into dependent bases of class templates" Microsoft specific behavior from -fms-extensions to -fms-compatibility.
llvm-svn: 144341
2011-11-11 00:12:11 +00:00
Ted Kremenek 61fb647fb4 [static analyzer] be more specific when running removeDeadBindings. Instead of seeing if the predecessor node was a non-StmtPoint, check if it is specifically a BlockEntrance node.
llvm-svn: 144340
2011-11-11 00:10:55 +00:00
Ted Kremenek e73d9ed1a2 Add top-level driver option '--serialize-diagnostics' for serialize compiler diagnostics to a file.
llvm-svn: 144339
2011-11-11 00:07:43 +00:00
Richard Smith 4a905b6799 Implicit casts from rvalue to lvalue are not meaningful. Don't accidentally add
them when performing a const conversion on the implicit object argument for a
member operator call on an rvalue.

No change to the testsuite: the test for this change is that the added
assertion does not fire any more.

llvm-svn: 144333
2011-11-10 23:32:36 +00:00
Ted Kremenek 20be0b4397 [static analyzer]: only call RemoveDeadBindings() when analyzing non-Expr stmts, entering a basic block, or analyzing non-consumed expressions. This sigificantly speeds up analysis time, and reduces analysis time down to 27% less than before we linearized the CFG.
llvm-svn: 144332
2011-11-10 23:26:10 +00:00
Pete Cooper 9d6055133b Add invariant.load metadata to loads from selector references. Allows these loads to later be moved/combined in the optimizer. Fixes <rdar://problem/6027699>
llvm-svn: 144318
2011-11-10 21:45:06 +00:00
Eli Friedman 5ceb8aa23e Add missing dependency for shared library build to CMakeLists. Patch by Johannes Obermayr.
llvm-svn: 144310
2011-11-10 20:07:09 +00:00
Devang Patel 63104ad417 Revert r144273. It causes clang self-host build failure.
llvm-svn: 144296
2011-11-10 17:47:39 +00:00
Benjamin Kramer 931ee8e727 serialized diagnostics: simplify code.
llvm-svn: 144277
2011-11-10 11:29:20 +00:00
John McCall f4beacd059 Whenever explicitly activating or deactivating a cleanup, we
need to provide a 'dominating IP' which is guaranteed to
dominate the (de)activation point but which cannot be avoided
along any execution path from the (de)activation point to
the push-point of the cleanup.  Using the entry block is
bad mojo.

llvm-svn: 144276
2011-11-10 10:43:54 +00:00
NAKAMURA Takumi c5a9aaca11 include/clang/AST/APValue.h: Try to fix *900* of cast-qual warnings by g++.
llvm-svn: 144275
2011-11-10 10:08:04 +00:00
NAKAMURA Takumi 27dd3964ac c-index-test.c: Fix a comment style. /* It is C source. */
llvm-svn: 144274
2011-11-10 10:07:57 +00:00
Richard Smith 656d49d890 Constant expression evaluation: support for constexpr member functions.
llvm-svn: 144273
2011-11-10 09:31:24 +00:00
NAKAMURA Takumi 77d9739249 c-index-test.c: Fix syntax. It is C source.
llvm-svn: 144272
2011-11-10 09:30:15 +00:00
John McCall e63abb5d2b Fix a subtle bug with cleanups: when activating
a previously-inactive cleanup, not only do we need a
flag variable, but we should also force the cleanup to
query the flag variable.  However, we only need to do
this when we're activating in a context that's
conditionally executed;  otherwise, we may safely
assume that the cleanup is dominated by the activation
point.

llvm-svn: 144271
2011-11-10 09:22:44 +00:00
Richard Smith 1c7047375a PR11148: Fix crash-on-invalid if an invalid member declaration is marked as
defaulted or deleted.

llvm-svn: 144270
2011-11-10 09:08:44 +00:00
Ted Kremenek d010ba4729 serialized diagnostics: implement full deserialization of clang diagnostics via the libclang API.
I've tested it on simple cases and it works.  Test cases to follow as well as a few tweaks.

llvm-svn: 144269
2011-11-10 08:43:12 +00:00
John McCall 08ef466048 Enter the cleanups for a block outside the enclosing
full-expression.  Naturally they're inactive before we enter
the block literal expression.  This restores the intended
behavior that blocks belong to their enclosing scope.

There's a useful -O0 / compile-time optimization that we're
missing here with activating cleanups following straight-line
code from their inactive beginnings.

llvm-svn: 144268
2011-11-10 08:15:53 +00:00
Richard Smith d62306a481 Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.

llvm-svn: 144265
2011-11-10 06:34:14 +00:00
David Blaikie 4d14296263 Removing unused initialization.
llvm-svn: 144264
2011-11-10 05:42:04 +00:00
John McCall 28fc70910f There's no good reason to track temporaries in ExprWithCleanups,
but it is sometimes useful to track blocks.  Do so.  Also
optimize the storage of these expressions.

llvm-svn: 144263
2011-11-10 05:35:25 +00:00
Richard Smith 5686e75a7b Temporary fix for a performance problem Eli spotted. The APValue representation
is currently too inefficient to allow us to use it for array initializers, but
fortunately we usually don't yet need to evaluate such initializers.

llvm-svn: 144260
2011-11-10 03:30:42 +00:00
Nick Lewycky 1679035122 Reflow lines, remove else-if after returns, rename variable "TydefContext" to
"TypedefContext". No functionality change.

llvm-svn: 144248
2011-11-10 00:34:02 +00:00
Eli Friedman f16beb3942 Fix some additional x86 intrinsics to use "I" (ICE) markings. Fix *mmintrin.h to take them into account.
<rdar://problem/10341145>

llvm-svn: 144246
2011-11-10 00:11:13 +00:00
Rafael Espindola 7e9e3a6c0c Fix the signature of __sigsetjmp and sigsetjmp. Patch by Dimitry Andric.
llvm-svn: 144237
2011-11-09 22:46:10 +00:00
Devang Patel 71510f6fb3 Remove unnecessary include.
llvm-svn: 144210
2011-11-09 21:08:24 +00:00
Fariborz Jahanian e0e6505660 objc rewriter: use a more specific name for local variable used
in fast enumeration rewrite. // rdar://10415026

llvm-svn: 144191
2011-11-09 17:41:43 +00:00
John McCall 29928fc563 We don't add ExprWithCleanups to the CFG, and getSVal looks
through it, so we should look through it for the live-values
analysis as well.

llvm-svn: 144190
2011-11-09 17:10:36 +00:00
Douglas Gregor 7240a95282 Define some built-ins macros on mips32 platform, from Simon Atanasyan!
llvm-svn: 144189
2011-11-09 15:17:16 +00:00
Benjamin Kramer 3757be395e Update test.
llvm-svn: 144185
2011-11-09 12:43:30 +00:00
Chandler Carruth b4aabc88f7 Try to fix an issue on some hosts where the 'lib' in the builtin include
path is actually a multilib.

llvm-svn: 144177
2011-11-09 08:26:57 +00:00
David Blaikie 21bfbf8d7c Fixing 80 col violations (& removing any trailing whitespace on files I was touching anyway)
llvm-svn: 144171
2011-11-09 06:07:30 +00:00
David Blaikie 8569b53e81 Fix 80 cols violations & remove trailing whitespace.
llvm-svn: 144170
2011-11-09 05:30:24 +00:00
Nick Lewycky 6aad6df4d1 Reflow one line I missed in previous cleanup commit. No functionality change.
llvm-svn: 144168
2011-11-09 04:27:23 +00:00
Nick Lewycky 2219ef0b68 Minor cleanup, mostly reindenting. Remove one helper function that just called
the other helper functions, since we already differentiated the cases it was
testing between. No functionality change.

llvm-svn: 144167
2011-11-09 04:25:21 +00:00
Chandler Carruth 6e46ca2c10 Fix an issue that Duncan discovered on a specific (no longer current)
version of Ubuntu. It has a very broken multiarch configuration, and so
we need special logic to handle it correctly. Fixing and testing this
uncovered a few other trivial issues with the logic that are fixed as
well.

I added tests to cover this as it is hard to notice if you install
recent versions of the OS.

llvm-svn: 144165
2011-11-09 03:46:20 +00:00
John McCall 3a237aa31c Emit the copy and dipose helpers for ARC __strong
block-typed __block variables using objc_retainBlock
and objc_dispose.  Previously we were using
_Block_object_assign and _Block_object_destroy
with BLOCK_BYREF_CALLER, which causes the runtime
to completely ignore the retain and release.
In most cases this doesn't cause catastrophe
because the retain/release are balanced and
because the block in the variable was copied
upon assignment there.  However, the stack
copy of the variable will be released when
it goes out of scope, which is a problem if
that value was released due to an assignment
to the heap copy.  Similarly, a leak can occur
if the variable is assigned after the copy to
the heap.

llvm-svn: 144162
2011-11-09 03:17:26 +00:00
Douglas Gregor 68b8fad7d2 Workaround for compilers that don't implement C++ DR45, from Tom Honermann!
llvm-svn: 144161
2011-11-09 03:05:27 +00:00
Douglas Gregor dbb9ea51fa Put ext_offsetof_extended_field_designator under the warning flag
-Wextended-offsetof, from Jeff Walden!

llvm-svn: 144160
2011-11-09 03:01:42 +00:00
Douglas Gregor f39a8dd445 Don't crash when transforming an ill-formed pseudo-destructor
expression. Fixes PR11339.

llvm-svn: 144159
2011-11-09 02:19:47 +00:00
John McCall d86532ee2c Extract the blocks-related ARC tests into their own file.
llvm-svn: 144158
2011-11-09 02:16:13 +00:00
Douglas Gregor 407d1f9624 Introduce proper spacing after the Objective-C parameter qualifiers
(bycopy, inout, etc.). Fixes <rdar://problem/10402900>.

llvm-svn: 144157
2011-11-09 02:13:45 +00:00
Richard Smith f8120cad16 Constant expression evaluation: support for default arguments.
llvm-svn: 144156
2011-11-09 02:12:41 +00:00
Devang Patel 8c2418594e Remove extra ';'
llvm-svn: 144155
2011-11-09 01:57:23 +00:00
Argyrios Kyrtzidis c137d0d62f [PCH] Fix reading from PCH of diagnostic pragmas.
In certain cases ASTReader would call the normal DiagnosticsEngine API to initialize
the state of diagnostic pragmas but DiagnosticsEngine would try to compare source locations
leading to crash because the main FileID was not yet initialized.

Yet another case of the ASTReader trying to use the normal APIs and inadvertently breaking
invariants. Fix this by having the ASTReader set up the internal state directly.

llvm-svn: 144153
2011-11-09 01:24:17 +00:00
Eli Friedman 16932001c9 Add "I" (ICE) annotations onto a few more x86 intrinsics.
llvm-svn: 144152
2011-11-09 01:08:43 +00:00
Argyrios Kyrtzidis 3a8de5b560 Don't crash on invalid objc code.
llvm-svn: 144150
2011-11-09 00:22:48 +00:00
Argyrios Kyrtzidis 485eceed38 [arcmt] Take into account that all properties are strong-by-default now and fix the test.
llvm-svn: 144146
2011-11-08 23:09:34 +00:00
John McCall 9a54961e01 Bind function "r-values" as l-values when emitting them as
opaque values.  Silly C type system.

llvm-svn: 144144
2011-11-08 22:54:08 +00:00
Fariborz Jahanian 557fc9a99d objc: Don't crash on missing @interface decl.
// rdar://10415026

llvm-svn: 144143
2011-11-08 22:51:27 +00:00
Anna Zaks 26573c5585 [analyzer] Testing: test with all the non-experimental checker packages.
llvm-svn: 144142
2011-11-08 22:41:25 +00:00
Anna Zaks a1b56e2aa3 [analyzer] Testing: support for regenerate reference output
Change the flow of the SATestAdd so that it could be used for regenerating
the reference output without exiting with an error.

llvm-svn: 144141
2011-11-08 22:41:22 +00:00
Argyrios Kyrtzidis e4a38a73fd [arcmt] Now that readonly properties are strong-by-default, do not add redundant 'strong'.
llvm-svn: 144136
2011-11-08 22:10:58 +00:00
Douglas Gregor 9bd86daa95 Fix comment typos
llvm-svn: 144120
2011-11-08 21:07:04 +00:00
Fariborz Jahanian b1ac0813a6 objc-arc: 'readonly' property of retainable object
type is strong by default too. // rdar://10410903

llvm-svn: 144118
2011-11-08 20:58:53 +00:00
Ted Kremenek da3cfc9fef Sort contents of exports file. No functionality change.
llvm-svn: 144116
2011-11-08 20:42:13 +00:00
Ted Kremenek cc88d264eb serialized diagnostics: serialize the version info in a separate meta block.
llvm-svn: 144115
2011-11-08 20:27:29 +00:00
Anna Zaks 0d58033bdb [analyzer] Remove redundant check from DivZeroChecker
Analysis by Ted:
"
    if (stateZero && !stateNotZero) {

is checking to see if:

  (A)  "it is possible for the value to be zero"   (stateZero)

    AND

  (B) "it is not possible for the value to be non-zero"  (!stateNotZero)

That said, the only way for both B to be true AND A to be false is if the path is completely infeasible by the time we reach the divide-by-zero check.  For the most part (all cases?), such cases should automatically get pruned out at branches (i.e., an infeasible path gets dropped), which is the case in our tests.  So the question is whether or not such an infeasible path might not get dropped earlier?  I can't envision any right now.

Indeed, the rest of the checker assumes that if the bug condition didn't fire then 'stateNotZero' is non-NULL:

    C.addTransition(stateNotZero);
"

llvm-svn: 144114
2011-11-08 19:56:35 +00:00
Anna Zaks 767d356f87 [analyzer] Testing: Display the number of reported differences in the main log.
llvm-svn: 144113
2011-11-08 19:56:31 +00:00
Eli Friedman 1307652185 This test isn't portable to non-x86 platforms; specify a triple.
llvm-svn: 144112
2011-11-08 19:55:32 +00:00
Douglas Gregor 6ea1d665a7 Mark the overloaded atomic builtins as having custom type checking,
which they do. This avoids all of the default argument promotions that
we (1) don't want, and (2) undo during that custom type checking, and
makes sure that we don't run into trouble during template
instantiation. Fixes PR11320.

llvm-svn: 144110
2011-11-08 19:45:38 +00:00
Eli Friedman 27b8c4f3fb Misc fixes for clang driver on Mips Linux. Patch by Simon Atanasyan.
llvm-svn: 144108
2011-11-08 19:43:37 +00:00
Axel Naumann fbc7b98e58 From Vassil Vassilev: add checks for removing Decls for more use cases.
llvm-svn: 144094
2011-11-08 18:21:06 +00:00
Chandler Carruth 475ab6ad7b Add a default system include of '/include'. This isn't particularly
useful when using Clang as a system-compiler, but its harmless. When
using Clang as a cross-compiler, this can be very handy as quite a few
toolchains ship their libc headers here rather than under
'/usr/include'.

For reference, this is the beginning of my work to also make the Clang
driver more suitable as a cross-compiler.

llvm-svn: 144089
2011-11-08 17:19:47 +00:00
Argyrios Kyrtzidis dbe077a89d [arcmt] Now that properties are strong by default, avoid adding redundant '(strong)'
property attribute.

llvm-svn: 144078
2011-11-08 05:56:11 +00:00
Argyrios Kyrtzidis 3befb8cd8a [arcmt] NSViewController does not support weak.
llvm-svn: 144077
2011-11-08 05:56:08 +00:00
Bob Wilson e4d7723b87 Check pointer types for arguments of Neon load/store macros. rdar://9958031
The Neon load/store intrinsics need to be implemented as macros to avoid
hiding alignment attributes on the pointer arguments, and the macros can
only evaluate those pointer arguments once (in case they have side effects),
so it has been hard to get the right type checking for those pointers.
I tried various alternatives in the arm_neon.h header, but it's much more
straightforward to just check directly in Sema.

llvm-svn: 144075
2011-11-08 05:04:11 +00:00
Eli Friedman 9586cdb01e Misc fixes to pcmp*stri.
llvm-svn: 144073
2011-11-08 04:13:51 +00:00
John McCall 0153cd3027 Fix the layout of vb-tables and vf-tables in the MS C++ ABI.
Based on work by Dmitry Sokolov!

llvm-svn: 144072
2011-11-08 04:01:03 +00:00
NAKAMURA Takumi dabda6b839 lib/CodeGen/CGBuiltin.cpp: Tweak the identifier "Type" to appease msvc.
llvm-svn: 144065
2011-11-08 03:27:04 +00:00
Peter Collingbourne 5ad3ebaefd TypePrinter: print OpenCL address space names. Patch by Richard
Membarth, test case by myself.

llvm-svn: 144063
2011-11-08 02:52:58 +00:00
Peter Collingbourne 32fab902de DeclPrinter: print the declaration's storage class specifier as
written, instead of the resolved storage class, which might not be
legal to specify on the declaration (such as out-of-line definitions
of static class members in C++, and __local variables in OpenCL).
Initial patch by Richard Membarth.

llvm-svn: 144062
2011-11-08 02:52:52 +00:00
Richard Smith ad45a8681d Some tests missed from r144056.
llvm-svn: 144060
2011-11-08 02:18:13 +00:00
Argyrios Kyrtzidis 2519a0801f [arcmt] When we already removed a __weak, don't try to change it to __unsafe_unretained
later on, or we will end up with a redundant '__unsafe_unretained'.

llvm-svn: 144059
2011-11-08 02:02:38 +00:00
Matt Beaumont-Gay fb3cb9a861 Revert r143972, which didn't actually compile under -Wnon-virtual-dtor.
(TIL: -Wnon-virtual-dtor is not in -Wall.)

llvm-svn: 144058
2011-11-08 01:53:17 +00:00
Richard Smith ec8dcd2716 Fix a cluster of related issues involving value-dependence and constant
expression evaluation:
 - When folding a non-value-dependent expression, we may try to use the
   initializer of a value-dependent variable. If that happens, give up.
 - In C++98, actually check that a const, non-volatile DeclRefExpr inside an ICE
   is of integral or enumeration type (a reference isn't OK!)
 - In C++11, DeclRefExprs for objects of const literal type initialized with
   value-dependent expressions are themselves value-dependent.
 - So are references initialized with value-dependent expressions (though this
   case is missing from the C++11 standard, along with many others).

llvm-svn: 144056
2011-11-08 01:31:09 +00:00
Bob Wilson 98bc98caa8 Clean up type flags for overloaded Neon builtins. No functional change.
This patch just adds a simple NeonTypeFlags class to replace the various
hardcoded constants that had been used until now.  Unfortunately I couldn't
figure out a good way to avoid duplicating that class between clang and
TableGen, but since it's small and rarely changes, that's not so bad.

llvm-svn: 144054
2011-11-08 01:16:11 +00:00
Anna Zaks ae9d54bcf3 [analyzer] Testing infrastructure: flush the output between projects.
llvm-svn: 144051
2011-11-08 00:27:56 +00:00
John McCall cfef546d40 There are some crazy cases that LookupMethodInReceiverType
doesn't duplicate, but they all surface as implicit
properties.  It's also a useful optimization to not
duplicate the implicit getter lookup.  So, trust the
getter lookup that was already done in these cases.

llvm-svn: 144031
2011-11-07 22:49:50 +00:00
Anna Zaks 9fed084503 [analyzer] Make sure scan-build catches all clang failures.
scan-build ignores clang failures in some cases, which might lead to
silent failure suppression. For example, if clang command line
argument is wrong. (Addresses radar://10406598)

llvm-svn: 144029
2011-11-07 22:38:10 +00:00
Richard Smith eda3c84698 constexpr: static data members declared constexpr are required to have an
initializer; all other constexpr variables are merely required to be
initialized. In particular, a user-provided constexpr default constructor can be
used for such initialization.

llvm-svn: 144028
2011-11-07 22:16:17 +00:00
Douglas Gregor 5d1b4e3d1f When we notice that a member function is defined with "= delete" or "=
default", make a note of which is used when creating the
initial declaration. Previously, we would wait until later to handle
default/delete as a definition, but this is too late: when adding the
declaration, we already treated the declaration as "user-provided"
when in fact it was merely "user-declared".

Fixes PR10861 and PR10442, along with a bunch of FIXMEs.

llvm-svn: 144011
2011-11-07 20:56:01 +00:00
Chad Rosier 8fe3b115cd Whitespace.
llvm-svn: 144002
2011-11-07 19:52:29 +00:00
Chad Rosier 1746e37cb8 Tablegenify -g options.
llvm-svn: 144001
2011-11-07 19:51:54 +00:00