Commit Graph

43725 Commits

Author SHA1 Message Date
Jordan Rose 111aa9a28b [analyzer] Don't accidentally strip off base object regions for lazy bindings.
If a base object is at a 0 offset, RegionStoreManager may find a lazy
binding for the entire object, then try to attach a FieldRegion or
grandparent CXXBaseObjectRegion on top of that (skipping the intermediate
region). We now preserve as many layers of base object regions necessary
to make the types match.

<rdar://problem/13239840>

llvm-svn: 175556
2013-02-19 20:28:33 +00:00
Daniel Jasper 6db1b7ca16 Add missing clang-format null pointer check..
.. and a test that triggers it in valid albeit questionable code.

llvm-svn: 175554
2013-02-19 20:05:41 +00:00
Argyrios Kyrtzidis e441264019 [modules] Const'ify some functions of ModuleMap.
llvm-svn: 175552
2013-02-19 19:58:45 +00:00
Argyrios Kyrtzidis 8739f7b7f6 [modules] Refactor code from ASTReader::makeModuleVisible() into a new function,
Module::getExportedModules() so it can be reused.

llvm-svn: 175548
2013-02-19 19:34:40 +00:00
Douglas Gregor cb15f086a5 Use MapVector::pop_back() per LLVM r175538.
llvm-svn: 175539
2013-02-19 18:26:28 +00:00
Sean Silva f2a472a321 [docs] Rename to permit wider variety of content.
I don't want to rule out the possibility of linking to e.g. interesting
blog posts about uses of Clang, so avoid restricting the content to
"projects".

This breaks URL compatibility, but this document was committed less than
an hour ago so hopefully nobody has linked to it yet.

llvm-svn: 175535
2013-02-19 17:29:01 +00:00
Sean Silva e3931a1cd4 [docs] Revise content on ExternalProjectsUsingClang page.
llvm-svn: 175534
2013-02-19 17:21:23 +00:00
Daniel Jasper 0047596cb0 Correctly format macro with unfinished template declaration.
We can now format:
  #define A template <typename T>

Before this created a segfault :-/.

llvm-svn: 175533
2013-02-19 17:14:38 +00:00
Edwin Vane 2c197e0939 Support in hasDeclaration for types with getDecl()
Using a new metafunction for detecting the presence of the member
'getDecl' in a type T, added support to hasDeclaration for any such type
T. This allows hasDecl() to be replaced and enables several other
subclasses of clang::Type to use hasDeclaration.

Updated unittests and LibASTMatchersReference.html.

Reviewers: klimek
llvm-svn: 175532
2013-02-19 17:14:34 +00:00
Sean Silva 63c3af69b8 [docs] Introduce ExternalProjectsUsingClang.rst
A couple concrete examples are sure to be a win. If you know of any
other external projects using Clang, please let me know!

Patch by Laszlo Nagy! (with a title tweak by me)

llvm-svn: 175529
2013-02-19 16:58:15 +00:00
Alexey Samsonov d26b3334b1 [Sanitizer] If -fsanitize-blacklist= option is not explicitly specified, make Clang look for the default sanitizer-specific blacklist in the resource directory.
llvm-svn: 175505
2013-02-19 11:25:29 +00:00
Timur Iskhodzhanov 2e9bd807e2 Add the missing 'static' keyword to the test
llvm-svn: 175502
2013-02-19 10:50:44 +00:00
Daniel Jasper 58f427ee41 Fix bug in LineState comparison function.
The key bug was

  if (Other.StartOfLineLevel < StartOfLineLevel) ..

instead of

  if (Other.StartOfLineLevel != StartOfLineLevel) ..

Also cleaned up the function to be more consistent in the comparisons.

llvm-svn: 175500
2013-02-19 09:28:55 +00:00
Eric Christopher 459d271756 More grammar.
llvm-svn: 175492
2013-02-19 06:16:53 +00:00
Aaron Ballman 16cd398a1a Fixing a typo where FixIts was accidentally self-assigning instead of assigning in the parameter Fixits. This fixes several failed assertions with MSVC debug builds.
llvm-svn: 175483
2013-02-19 02:32:05 +00:00
John McCall b4a99d3194 Add support for -fvisibility-ms-compat.
We treat this as an alternative to -fvisibility=<?>
which changes the default value visibility to "hidden"
and the default type visibility to "default".

Expose a -cc1 option for changing the default type
visibility, repurposing -fvisibility as the default
value visibility option (also setting type visibility
from it in the absence of a specific option).

rdar://13079314

llvm-svn: 175480
2013-02-19 01:57:35 +00:00
John McCall a496098bb8 Use the actual class visibility for the ObjC EHTYPE global,
not the global visibility mode.

Noticed by inspection.

llvm-svn: 175479
2013-02-19 01:57:29 +00:00
Bill Wendling 9721035f2d Temporarily revert r175471 for more review.
llvm-svn: 175477
2013-02-19 00:53:07 +00:00
Bill Wendling 63318ce957 Add a 'no-builtin' attribute if we do not want to simplify calls.
llvm-svn: 175471
2013-02-18 23:17:48 +00:00
David Blaikie 7cba50dfd4 Use LLVM_DELETED_FUNCTION rather than '// do not implement' comments.
Also removes some redundant DNI comments on function declarations already
using the macro.

llvm-svn: 175465
2013-02-18 23:11:09 +00:00
David Blaikie 6adc78e0df Replace TypeLoc llvm::cast support to be well-defined.
The TypeLoc hierarchy used the llvm::cast machinery to perform undefined
behavior by casting pointers/references to TypeLoc objects to derived types
and then using the derived copy constructors (or even returning pointers to
derived types that actually point to the original TypeLoc object).

Some context is in this thread:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html
Though it's spread over a few months which can be hard to read in the mail
archive.

llvm-svn: 175462
2013-02-18 22:06:02 +00:00
Dmitri Gribenko 7d09808818 libclang: don't store nul-terminated strings as StringRefs,
if the nul-terminatedness property is important for clients.

Also, don't return the same CXString multiple times.  This did not create a
correctness issue in practice because the CXString was of an CXS_Unmanaged
kind, and destruction was a no-op.

llvm-svn: 175455
2013-02-18 19:50:38 +00:00
David Blaikie b61d087d40 Clean up last use of dyn_cast on TypeLoc in ASTMatchers
llvm-svn: 175454
2013-02-18 19:04:16 +00:00
Fariborz Jahanian 6ebe3959aa Test for my last patch. // rdar://13178483
llvm-svn: 175453
2013-02-18 19:02:44 +00:00
Argyrios Kyrtzidis 774c2479ad Add include guards for CommentVisitor.h
llvm-svn: 175451
2013-02-18 18:31:16 +00:00
Fariborz Jahanian 223ca5c9ab Prevent crash on multiple user errors (which I cannot reproduce in
a small test case). // rdar://13178483.

llvm-svn: 175450
2013-02-18 17:22:23 +00:00
Douglas Gregor 1c15cd6aaa CodeGenFunction::CurFuncDecl can be NULL; fix crash introduced in r175386.
llvm-svn: 175448
2013-02-18 15:59:24 +00:00
Douglas Gregor 6168bd2323 Ensure that the identifier chains have the most recent declaration after module deserialization.
This commit introduces a set of related changes to ensure that the
declaration that shows up in the identifier chain after deserializing
declarations with a given identifier is, in fact, the most recent
declaration. The primary change involves waiting until after we
deserialize and wire up redeclaration chains before updating the
identifier chains. There is a minor optimization in here to avoid
recursively deserializing names as part of looking to see whether
top-level declarations for a given name exist.

A related change that became suddenly more urgent is to property
record a merged declaration when an entity first declared in the
current translation unit is later deserialized from a module (that had
not been loaded at the time of the original declaration). Since we key
off the canonical declaration (which is parsed, not from an AST file)
for emitted redeclarations, we simply record this as a merged
declaration during AST writing and let the readers merge them.

Re-fixes <rdar://problem/13189985>, presumably for good this time.

llvm-svn: 175447
2013-02-18 15:53:43 +00:00
Daniel Jasper e53beb2647 Improve indentation of builder type calls.
In builder-type calls, it can be very confusing to just indent
parameters from the start of the line. Instead, indent 4 from the
correct function call.

Before:
aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break
    aaaaaaaaaaaaaa);
aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()->aaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
    ->aaaaaaaaaaaaaaaaa();

After:
aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break
                                        aaaaaaaaaaaaaa);
aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()
    ->aaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
    ->aaaaaaaaaaaaaaaaa();

llvm-svn: 175444
2013-02-18 13:52:06 +00:00
Daniel Jasper 9ed9ade0ef Improve formatting of builder-type calls.
Before:
aaaaaaa->aaaaaaa->aaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)->aaaaaaaa(aaaaaaaaaaaaaaa);

After:
aaaaaaa->aaaaaaa
    ->aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
    ->aaaaaaaa(aaaaaaaaaaaaaaa);

llvm-svn: 175441
2013-02-18 13:24:21 +00:00
Daniel Jasper 55d7ba6b66 Reformat lines if they were "moved around".
An unwrapped line can get moved around if there is no newline before
it and the previous line was formatted.

Example:

  template<typename T>  // Cursor is on this line when hitting "format"
  T *getFETokenInfo() const { return static_cast<T*>(FETokenInfo); }

"return .." is the second unwrapped line in this scenario. I does not
touch any reformatted region. Thus, the result of formatting is:

  template <typename T> T *getFETokenInfo() const { return static_cast<T *>(FETokenInfo); }

After second format (and arguably desired end-result):

  template <typename T> T *getFETokenInfo() const {
      return static_cast<T *>(FETokenInfo);
  }

This fixes: llvm.org/PR15060.

llvm-svn: 175440
2013-02-18 13:08:03 +00:00
Daniel Jasper 5065bc4b2c Correctly determine */& usage in more cases.
This fixes llvm.org/PR15248.

Before:
Test::Test(int b) : a(b *b) {}
for (int i = 0; i < a *a; ++i) {}

After:
Test::Test(int b) : a(b * b) {}
for (int i = 0; i < a * a; ++i) {}

llvm-svn: 175439
2013-02-18 12:44:35 +00:00
Tim Northover 847d2d4549 AArch64: add atomic support parameters to TargetInfo
This allows Clang to detect and deal wih __atomic_* operations properly on
AArch64. Previously we produced an error when encountering them at high
optimisation levels.

llvm-svn: 175438
2013-02-18 12:11:32 +00:00
Daniel Jasper 2ec3ffb86e Always break after multi-line string literals.
Otherwise, other parameters can be quite hidden.
Reformatted unittests/Format/FormatTest.cpp after this.

Before:
someFunction("Always break between multi-line"
             " string literals", and, other, parameters);

After:
someFunction("Always break between multi-line"
             " string literals",
             and, other, parameters);

llvm-svn: 175436
2013-02-18 11:59:17 +00:00
Daniel Jasper 40c36c54ca Prevent line breaks that make stuff hard to read.
Before:
aaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
    .aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
    .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa,
                         aaaaaaaaaaaaaaaaaaa,
                         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 175432
2013-02-18 11:05:07 +00:00
David Blaikie 176e72bd48 Update test cases to account for DIBuilder type changes.
Paired commit with LLVM, may produce temporary build breakage.

llvm-svn: 175427
2013-02-18 07:27:35 +00:00
Ted Kremenek 3e05be9de3 Disable dead stores checker for template instantations. Fixes <rdar://problem/13213575>.
llvm-svn: 175425
2013-02-18 07:18:28 +00:00
Eric Christopher c32fb5969c Fix up grammar a bit.
llvm-svn: 175418
2013-02-18 04:38:06 +00:00
Eric Christopher 8d56caaaec Unify some "kernel or kext" conditionals.
llvm-svn: 175414
2013-02-18 01:16:37 +00:00
Eric Christopher 943dfc1baf Add a comment.
llvm-svn: 175412
2013-02-18 00:38:34 +00:00
Eric Christopher 5ecce125c5 Clean up comment.
llvm-svn: 175411
2013-02-18 00:38:31 +00:00
Eric Christopher f4d15c618c Grammar.
llvm-svn: 175410
2013-02-18 00:38:28 +00:00
Eric Christopher 14668dd4af Unify some code. No functional change.
llvm-svn: 175409
2013-02-18 00:38:25 +00:00
Dmitri Gribenko dfe49e8c31 Test ivar-invariant.m: use a more idiomatic RUN line and tighten the test
by matching the function name first

llvm-svn: 175395
2013-02-17 14:59:41 +00:00
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
Dmitri Gribenko 6cfb1537b6 Remove a const_cast by propagating constness to called functions
llvm-svn: 175161
2013-02-14 13:53:30 +00:00
Dmitri Gribenko 60e92e55cc Remove an unneeded const_cast
llvm-svn: 175160
2013-02-14 13:49:48 +00:00
Dmitri Gribenko 81f2575692 Remove const_casts by making spec_begin()/spec_end() const
llvm-svn: 175159
2013-02-14 13:20:36 +00:00
Daniel Jasper 2457010b1c Remove the trailing whitespace of formatted lines.
So far, clang-format has always assumed the whitespace belonging to the
subsequent token. This has the negative side-effect that when
clang-format formats a line, it does not remove its trailing whitespace,
as it belongs to the next token.

Thus, this patch fixes most of llvm.org/PR15062.

We are not zapping a file's trailing whitespace so far, as this does not
belong to any token we see during formatting. We need to fix this in a
subsequent patch.

llvm-svn: 175152
2013-02-14 09:58:41 +00:00
Daniel Jasper 66e9dee707 Get less confused by trailing comma in Google style.
The formatter can now format:
void aaaaaaaaaaaaaaaaaa(int level,
                        double *min_x,
                        double *max_x,
                        double *min_y,
                        double *max_y,
                        double *min_z,
                        double *max_z, ) {
}

Although this is invalid code, it frequently happens during development and
clang-format should be nicer :-).

llvm-svn: 175151
2013-02-14 09:19:04 +00:00
Daniel Jasper b315ede9c1 Remove accidentally committed empty test.
llvm-svn: 175148
2013-02-14 08:45:14 +00:00