Commit Graph

43590 Commits

Author SHA1 Message Date
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
Daniel Jasper eead02b1b5 Align superclasses for multiple inheritence.
This fixes llvm.org/PR15179.

Before:
class ColorChooserMac : public content::ColorChooser,
    public content::WebContentsObserver {
};

After:
class ColorChooserMac : public content::ColorChooser,
                        public content::WebContentsObserver {
};

llvm-svn: 175147
2013-02-14 08:42:54 +00:00
Bill Wendling d7d8625f4c Revert accidental commit.
llvm-svn: 175143
2013-02-14 08:18:53 +00:00
Bill Wendling c86a2f39a9 Pass the target options through to code generation.
The code generation stuff is going to set attributes on the functions it
generates. To do that it needs the target options. Pass them through.

llvm-svn: 175141
2013-02-14 08:09:20 +00:00
Rafael Espindola 46d2b6bacf Partially revert r175117 so that we don't break assumptions about how
static functions in extern "C" contexts are mangled. Should fix the
bootstrap.

llvm-svn: 175132
2013-02-14 03:31:26 +00:00
Rafael Espindola 5bda63f16b merge hasCLanguageLinkage and isExternC. Keep the shorter name.
I added hasCLanguageLinkage while fixing some language linkage bugs some
time ago so that I wouldn't have to check all users of isExternC. It turned
out to be a much longer detour than expected, but this patch finally
merges the two again. The isExternC function now implements just the
standard notion of having C language linkage.

llvm-svn: 175119
2013-02-14 01:47:04 +00:00
Rafael Espindola f4187658fa Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fix
some cases where functions with no language linkage were being treated as having
C language linkage. In particular, don't warn in

extern "C" {
  static NonPod foo();
}

Since getLanguageLinkage checks the language linkage, the linkage computation
cannot use the language linkage. Break the loop by checking just the context
in the linkage computation.

llvm-svn: 175117
2013-02-14 01:18:37 +00:00
Nick Lewycky b7444cd11e When marking derived classes' virtual methods ODR-used in order to trigger
instantiation in order to permit devirtualization later in codegen, skip over
pure functions since those can't be devirtualization targets.

llvm-svn: 175116
2013-02-14 00:55:17 +00:00
Ted Kremenek 3cfba5bf13 Teach ccc-analyze to pass on -iquote with no spaces between it an the argument.
llvm-svn: 175115
2013-02-14 00:32:25 +00:00
Richard Smith d06a87047d Actually fix rendering of the example code block!
llvm-svn: 175113
2013-02-14 00:23:04 +00:00
Richard Smith fabbcd9bcf Some grammar fixes to 'Format String Checking', and reorder the text slightly to try to make the final code block actually get rendered.
llvm-svn: 175112
2013-02-14 00:22:00 +00:00
Richard Smith f6d2d3bb40 Document Clang's support for [[gnu::...]] attributes.
llvm-svn: 175110
2013-02-14 00:13:34 +00:00
Argyrios Kyrtzidis f0ad09f8f6 [docs] The stat cache has been removed from the PCH, update the docs to remove mentions of it.
llvm-svn: 175109
2013-02-14 00:12:44 +00:00
Fariborz Jahanian 3c8220405d objective-C: Make order of ivars which are synthesized
in the course of property synthesis deterministic (ordered
by their type size), instead of having hashtable order
(as it is currently). // rdar://13192366

llvm-svn: 175100
2013-02-13 22:50:36 +00:00
Tanya Lattner 33455e10c9 Remove outdated performance.html webpage.
llvm-svn: 175090
2013-02-13 21:51:18 +00:00
Chad Rosier 5bdd8ed74d [ms-inline asm] Add test case for r175083.
llvm-svn: 175084
2013-02-13 21:34:54 +00:00
Richard Smith 2c5868c334 ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type.

llvm-svn: 175078
2013-02-13 21:18:23 +00:00
Daniel Jasper b9caeacd02 Allow breaking after the return type in function declarations.
This has so far been disabled for Google style, but should be done
before breaking at nested name specifiers or in template parameters.

Before (in Google style):
template <typename T>
aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaa<
    T>::aaaaaaa() {}

After:
template <typename T>
aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa>
aaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaa() {}

llvm-svn: 175074
2013-02-13 20:33:44 +00:00
Bill Wendling 41529c13c4 Use 'RC_XBS' instead of 'RC_BUILDIT' to catch all times when it's built in the Apple way.
llvm-svn: 175070
2013-02-13 19:44:17 +00:00
Daniel Jasper 525264c369 Fix comment alignment close to the column limit.
Due to an error in one of the expressions, we used to not align comments
although it would have been possible.

llvm-svn: 175068
2013-02-13 19:25:54 +00:00
Argyrios Kyrtzidis 5d47a9b253 [libclang] Fix annotation of a range where the begin or end location
is inside a macro argument.

Previously we would give up and not annotate anything in the range.
rdar://11891550

llvm-svn: 175062
2013-02-13 18:33:28 +00:00
Timur Iskhodzhanov 753875d324 ... and now fix the +Asserts build
llvm-svn: 175054
2013-02-13 12:24:19 +00:00
Timur Iskhodzhanov 6d5dbc6464 Fix the microsoft-abi-structors test expectations to match both Release and Release+Asserts builds
llvm-svn: 175053
2013-02-13 12:14:25 +00:00
Manuel Klimek af491072ee Pull search state out as class members.
Fix some comments.

llvm-svn: 175052
2013-02-13 10:54:19 +00:00
Manuel Klimek 2ef908e4e2 An attempt to make the search algorithm easier to understand.
- clear ownership: the SpecificBumpPtrAllocator owns all StateNodes
- this allows us to simplify the memoization data structure into a
  std::set (FIXME: figure out whether we want to use a hash based
  data structure).
- introduces StateNode as recursive data structure, instead of using
  Edge and the Seen-map combined to drill through the graph
- using a count to stabilize the penalty instead of relying on the
  container
- pulled out a method to forward-apply states in the end

This leads to a ~40% runtime decrease on Nico's benchmark.

Main FiXME is that the parameter lists of some function get too long.
I'd vote for either pulling the Queue etc into the Formatter proper,
or creating an inner class just for the search algorithm.

llvm-svn: 175051
2013-02-13 10:46:36 +00:00
Timur Iskhodzhanov ee6bc53365 Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058
llvm-svn: 175045
2013-02-13 08:37:51 +00:00
Nico Weber 71800c46ae Formatter: And more cast tests (these don't pass yet).
llvm-svn: 175031
2013-02-13 04:40:03 +00:00
Nico Weber 4401b2a4e2 Formatter: Add more cast tests.
llvm-svn: 175030
2013-02-13 04:32:57 +00:00
Nico Weber c6fe2165c9 Formatter: Refactor the cast detection code to be a bit more readable.
No functionality change. Also add another cast test.

llvm-svn: 175029
2013-02-13 04:13:13 +00:00
Nico Weber a789239c64 Formatter: Detect ObjC method expressions after casts.
Not all casts are correctly detected yet, but it helps in some cases.

llvm-svn: 175028
2013-02-13 03:48:27 +00:00
Nick Lewycky 9ffb3499a5 Change this comment to helpfully explain why it's there.
llvm-svn: 175027
2013-02-13 03:34:21 +00:00
Jordan Rose 42b130b20a [analyzer] Use Clang's evaluation for global constants and default arguments.
Previously, we were handling only simple integer constants for globals and
the smattering of implicitly-valued expressions handled by Environment for
default arguments. Now, we can use any integer constant expression that
Clang can evaluate, in addition to everything we handled before.

PR15094 / <rdar://problem/12830437>

llvm-svn: 175026
2013-02-13 03:11:06 +00:00
Jordan Rose ff0dd946b1 [analyzer] Use makeZeroVal in RegionStore's lazy evaluation of statics.
No functionality change.

llvm-svn: 175025
2013-02-13 03:11:01 +00:00
Chad Rosier 8356d091bf [ms-inline-asm] Test cases to ensure the AsmRewrite list is sorted (r175021).
Part of rdar://13202662

llvm-svn: 175022
2013-02-13 01:06:08 +00:00
Douglas Gregor c14895645d Order the methods in the global method pool based on when they become visible, not when they become deserialized <rdar://problem/13203033>.
llvm-svn: 175018
2013-02-12 23:36:21 +00:00
Dmitri Gribenko 64bbf7e5f3 Replace 'signed' with 'int'. 'signed' is not typical for LLVM style
llvm-svn: 175015
2013-02-12 22:40:22 +00:00