Commit Graph

43631 Commits

Author SHA1 Message Date
Lang Hames 01248e4cdc Remove block names from test case to unbreak release builds.
Thanks Chandler. :)

llvm-svn: 175392
2013-02-17 10:18:28 +00:00
James Dennett e8ee9e53f7 Documentation: use \brief and don't duplicate the name of the declared entity
at the start of the doc comment.

llvm-svn: 175391
2013-02-17 08:24:19 +00:00
James Dennett 5d0da59b3d Documentation cleanup: fix a typo ("////" for "///") and suppress Doxygen's
automatic link generation for "file:", as it's not used as a URL here.

llvm-svn: 175390
2013-02-17 08:19:35 +00:00
Lang Hames bf122744e5 Re-apply r174919 - smarter copy/move assignment/construction, with fixes for
bitfield related issues.

The original commit broke Takumi's builder. The bug was caused by bitfield sizes
being determined by their underlying type, rather than the field info. A similar
issue with bitfield alignments showed up on closer testing. Both have been fixed
in this patch.

llvm-svn: 175389
2013-02-17 07:22:09 +00:00
Saleem Abdulrasool 7a786f8c7a [clang] fix test execution command
Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 175387
2013-02-17 04:13:35 +00:00
Saleem Abdulrasool 5f25bc30d1 [CodeGen] tighten objc ivar invariant.load attribution
An ivar ofset cannot be marked as invariant load in all cases.  The ivar offset
is a lazily initialised constant, which is dependent on an objc_msgSend
invocation to perform a fixup of the offset.  If the load is being performed on
a method implemented by the class then this load can safely be marked as an
inviarant because a message must have been passed to the class at some point,
forcing the ivar offset to be resolved.

An additional heuristic that can be used to identify an invariant load would be
if the ivar offset base is a parameter to an objc method.  However, without the
parameters available at hand, this is currently not possible.

Reviewed-by: John McCall <rjmccall@apple.com>
Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
llvm-svn: 175386
2013-02-17 04:03:34 +00:00
Dmitri Gribenko b633eab8cb Fix for ARM: functions don't have extra attributes there, so {{.*}} is ""
While there, explicitly declare functions to remove warnings.

llvm-svn: 175384
2013-02-17 03:06:16 +00:00
Dmitri Gribenko 20b16ace16 Use trailing documentation comments properly
Patch by Alexander Zinenko.

llvm-svn: 175376
2013-02-16 22:21:38 +00:00
Dmitri Gribenko 97499ed60e Use the correct type to hold enumeration values
llvm-svn: 175374
2013-02-16 20:03:26 +00:00
James Dennett 49049ee8c7 Documentation cleanup: make a \brief be brief, and fix a bad use of \see.
llvm-svn: 175340
2013-02-16 08:16:47 +00:00
James Dennett bd59295fb7 Documentation cleanup: use \brief, and don't repeat the identifier being
declared.

llvm-svn: 175339
2013-02-16 07:45:22 +00:00
Jordan Rose 9ed04aa7ac libAnalysis: Add a case for TypeAliasDecl in CFGRecStmtDeclVisitor.
Neither of the current clients of CFGRecStmtDeclVisitor are doing
anything with typedefs, so I assume type aliases (C++11 "using")
can be safely ignored. This was causing assertion failures in
the analyzer.

<rdar://problem/13228440>

llvm-svn: 175335
2013-02-16 01:33:16 +00:00
Dmitri Gribenko 19b79c8bf9 libclang: remove reinterpret_casts by using SourceLocation::getPtrEncoding
llvm-svn: 175333
2013-02-16 01:07:48 +00:00
Dmitri Gribenko cea5ad4c0d Remove unused forward declarations
clang/AST/Decl.h is included to see the TypeSourceInfo definition anyway.

llvm-svn: 175332
2013-02-16 01:06:07 +00:00
David Blaikie bcd4b5521d Don't warn on conversion from NULL to nullptr_t
llvm-svn: 175331
2013-02-16 00:56:22 +00:00
Richard Smith 65fd2a4e90 Emit vtables for an extern template class as available_externally, not as
linkonce_odr. Emit construction vtables as internal in this case, since the ABI
does not guarantee that they will be availble externally.

llvm-svn: 175330
2013-02-16 00:51:21 +00:00
Argyrios Kyrtzidis 83a6e3bfab [PCH] Deserializing the DeclContext of a template parameter is not safe
until recursive loading is finished.

Otherwise we may end up with a template trying to deserialize a template
parameter that is in the process of getting loaded.

rdar://13135282

llvm-svn: 175329
2013-02-16 00:48:59 +00:00
Dmitri Gribenko 0062ba6494 Remove unused forward declarations
llvm-svn: 175328
2013-02-16 00:41:34 +00:00
John McCall df25c43599 Rework the visibility computation algorithm in preparation
for distinguishing type vs. value visibility.

The changes to the visibility of explicit specializations
are intentional.  The change to the "ugly" test case is
a consequence of a sensible implementation, and I am happy
to argue that this is better behavior.  Other changes may
or may not be intended;  it is quite difficult to divine
intent from some of the code I altered.

I've left behind a comment which I hope explains the
philosophy behind visibility computation.

llvm-svn: 175326
2013-02-16 00:17:33 +00:00
Chad Rosier 77d56be3f0 Add test case for r175312.
llvm-svn: 175313
2013-02-15 21:58:41 +00:00
Bill Wendling 985d1c5d15 Add the 'target-cpu' and 'target-features' attributes to functions.
The back-end will use these values to reconfigure code generation for different
features.

llvm-svn: 175308
2013-02-15 21:30:01 +00:00
Dmitri Gribenko 0035372bb7 libclang: add clang_getTypeSpelling(CXType CT)
Adds a function clang_getTypeSpelling(CXType CT) that returns
a CXString containing the underlying type.

Patch by Ben Gertzfield.

llvm-svn: 175299
2013-02-15 21:15:49 +00:00
Fariborz Jahanian d4c1a2063c objective-C: Fixes a compiler crash when encoding
an ivar of type pointer to a typedef'ed object.
// rdar://13190095

llvm-svn: 175298
2013-02-15 21:14:50 +00:00
Daniel Jasper eb50c676ba Recognize < and > as binary expressions in builder-type calls.
The current heuristic assumes that there can't be binary operators in
builder-type calls (excluding assigments). However, it also excluded
< and > in general, which is wrong. Now they are only excluded if they
are template parameters.

Before:
return aaaaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa()i
       .aaaaaa() < aaaaaaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa().aaaaaa();

After:
return aaaaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa().aaaaaa() <
       aaaaaaaaaaaaaaaaaaa->aaaaa().aaaaaaaaaaaaa().aaaaaa();

llvm-svn: 175291
2013-02-15 20:33:06 +00:00
Enea Zaffanella 2f40be7511 Fixed diagnostic nondeterministic order bug (pr14901).
llvm-svn: 175289
2013-02-15 20:09:55 +00:00
Daniel Jasper 0af92ebb20 Done break between 'operator' and '<<'.
Before:
ostream &operator
    <<(ostream &out, some::ns::SomeReallyLongType WithSomeReallyLongValue);

After:
ostream &operator<<(ostream &out,
                    some::ns::SomeReallyLongType WithSomeReallyLongValue);

llvm-svn: 175286
2013-02-15 19:24:08 +00:00
Argyrios Kyrtzidis 336cc8b9af Fix crash-on-invalid where a ParenListExpr shows up as a message receiver
while trying to do error recovery.

rdar://13207886

llvm-svn: 175282
2013-02-15 18:34:15 +00:00
Argyrios Kyrtzidis e6e422b1ee When a statement is dropped from the AST because it was invalid, make sure
we don't do the scope checks otherwise we are going to hit assertion checks
since a label may not have been actually added.

llvm-svn: 175281
2013-02-15 18:34:13 +00:00
Daniel Jasper 23e8e0c7ea Re-enable ConstructorInitializerAllOnOneLineOrOnePerLine option.
This got lost and was untested as the same effect is achieved by
avoiding bin packing, which is active in Google style by default.
However, moving forward, we want more control over the bin packing
option(s) and thus, this flag should work as expected.

llvm-svn: 175277
2013-02-15 16:49:44 +00:00
Benjamin Kramer 25c0510690 Sema: Unnest early exit and remove an unnecessary bad cast.
cast<ObjCObjectPointerType> doesn't look through sugar, getAs does.
Fixes PR15257.

llvm-svn: 175272
2013-02-15 15:17:50 +00:00
Timur Iskhodzhanov d619711c64 Abstract out emitting the vdtor calls and do it properly when using -cxx-abi microsoft; also fix vdtor calls for the ARM ABI
llvm-svn: 175271
2013-02-15 14:45:22 +00:00
Benjamin Kramer 3e3502686b Make helper functions static.
llvm-svn: 175265
2013-02-15 12:30:38 +00:00
Daniel Jasper 54a8602aef Prevent only breaking before "?" in conditional expressions.
This is almost always more readable.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    ? aaaaaaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    ? aaaaaaaaaaaaaaaaaaaaaaaaaaa
    : aaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 175262
2013-02-15 11:07:25 +00:00
Bill Wendling 48939ced20 Update testcases due to Attribute sorting improvements.
llvm-svn: 175253
2013-02-15 05:25:49 +00:00
Jordan Rose 5bc0dd79e1 [analyzer] Don't assert when mixing reinterpret_cast and derived-to-base casts.
This just adds a very simple check that if a DerivedToBase CastExpr is
operating on a value with known C++ object type, and that type is not the
base type specified in the AST, then the cast is invalid and we should
return UnknownVal.

In the future, perhaps we can have a checker that specifies that this is
illegal, but we still shouldn't assert even if the user turns that checker
off.

PR14872

llvm-svn: 175239
2013-02-15 01:23:24 +00:00
Jordan Rose 88bb563c43 Re-apply "[analyzer] Model trivial copy/move ctors with an aggregate bind."
...after a host of optimizations related to the use of LazyCompoundVals
(our implementation of aggregate binds).

Originally applied in r173951.
Reverted in r174069 because it was causing hangs.
Re-applied in r174212.
Reverted in r174265 because it was /still/ causing hangs.

If this needs to be reverted again it will be punted to far in the future.

llvm-svn: 175234
2013-02-15 00:32:15 +00:00
Jordan Rose 2516d7b0e8 [analyzer] Cache the bindings accessible through a LazyCompoundVal.
This means we don't have to recompute them all later for every
removeDeadSymbols check.

llvm-svn: 175233
2013-02-15 00:32:12 +00:00
Jordan Rose 3dc0509e3c [analyzer] Scan the correct store when finding symbols in a LazyCompoundVal.
Previously, we were scanning the current store. Now, we properly scan the
store that the LazyCompoundVal came from, which may have very different
live symbols.

llvm-svn: 175232
2013-02-15 00:32:10 +00:00
Jordan Rose c187146003 [analyzer] Tweak LazyCompoundVal reuse check to ignore qualifiers.
This is optimization only; no behavioral change.

llvm-svn: 175231
2013-02-15 00:32:08 +00:00
Jordan Rose 44d877a8c7 [analyzer] Use collectSubRegionKeys to make removeDeadBindings faster.
Previously, whenever we had a LazyCompoundVal, we crawled through the
entire store snapshot looking for bindings within the LCV's region. Now, we
just ask for the subregion bindings of the lazy region and only visit those.

This is an optimization (so no test case), but it may allow us to clean up
more dead bindings than we were previously.

llvm-svn: 175230
2013-02-15 00:32:06 +00:00
Jordan Rose e3fd708f9c [analyzer] Refactor RegionStore's sub-region bindings traversal.
This is going to be used in the next commit.
While I'm here, tighten up assumptions about symbolic offset
BindingKeys, and make offset calculation explicitly handle all
MemRegion kinds.

No functionality change.

llvm-svn: 175228
2013-02-15 00:32:03 +00:00
Fariborz Jahanian dbe483c80d Make this test determinstic for my last patch.
// rdar://13192366

llvm-svn: 175217
2013-02-14 22:38:41 +00:00
Fariborz Jahanian aedaaa4f35 objective-C: synthesize properties in order of their
declarations to synthesize their ivars in similar
determinstic order so they are laid out in
a determinstic order. // rdar://13192366

llvm-svn: 175214
2013-02-14 22:33:34 +00:00
Dmitri Gribenko 6b8fca1275 libclang: remove reinterpret_casts by using SourceLocation::getFromPtrEncoding
directly instead of casting a pointer to an integer

llvm-svn: 175206
2013-02-14 20:07:36 +00:00
Fariborz Jahanian a934a022af objective-C: When implementing custom accessor method for
a property, the -Wdirect-ivar-access should not warn when 
accessing the property's synthesized instance variable.
// rdar://13142820

llvm-svn: 175195
2013-02-14 19:07:19 +00:00
Jordan Rose ba4a6d10e0 [analyzer] Try constant-evaluation for all variables, not just globals.
In C++, constants captured by lambdas (and blocks) are not actually stored
in the closure object, since they can be expanded at compile time. In this
case, they will have no binding when we go to look them up. Previously,
RegionStore thought they were uninitialized stack variables; now, it checks
to see if they are a constant we know how to evaluate, using the same logic
as r175026.

This particular code path is only for scalar variables. Constant arrays and
structs are still unfortunately unhandled; we'll need a stronger solution
for those.

This may have a small performance impact, but only for truly-undefined
local variables, captures in a non-inlined block, and non-constant globals.
Even then, in the non-constant case we're only doing a quick type check.

<rdar://problem/13105553>

llvm-svn: 175194
2013-02-14 19:06:11 +00:00
Argyrios Kyrtzidis d07fabf034 [arcmt] Make sure the function has an associated parameter for the argument
before checking for its attributes.

rdar://13192395

llvm-svn: 175184
2013-02-14 17:29:16 +00:00
Rafael Espindola 3e0e33d7e5 Mangle extern "C" functions whose names are not simple identifiers.
llvm-svn: 175166
2013-02-14 15:38:59 +00:00
Daniel Jasper e11095aff1 Fix counting of parameters so that r175162 works as expected.
Before:
aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
                              .aaaaaaaaaaaaaaaaa());

After:
aaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa());

Not sure which of the formattings above is better, but we should not pick
one by accident.

llvm-svn: 175165
2013-02-14 15:01:34 +00:00
Daniel Jasper 687af3bb53 Reduce penalty for breaking before ./-> after complex calls.
This gives a clearer separation of the context, e.g. in GMOCK
statements.

Before:
EXPECT_CALL(SomeObject,
            SomeFunction(Parameter)).WillRepeatedly(Return(SomeValue));

After:
EXPECT_CALL(SomeObject, SomeFunction(Parameter))
    .WillRepeatedly(Return(SomeValue));

Minor format cleanups.

llvm-svn: 175162
2013-02-14 14:26:07 +00:00