]> granicus.if.org Git - clang/log
clang
11 years ago[analyzer] Try constant-evaluation for all variables, not just globals.
Jordan Rose [Thu, 14 Feb 2013 19:06:11 +0000 (19:06 +0000)]
[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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175194 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[arcmt] Make sure the function has an associated parameter for the argument
Argyrios Kyrtzidis [Thu, 14 Feb 2013 17:29:16 +0000 (17:29 +0000)]
[arcmt] Make sure the function has an associated parameter for the argument
before checking for its attributes.

rdar://13192395

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175184 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMangle extern "C" functions whose names are not simple identifiers.
Rafael Espindola [Thu, 14 Feb 2013 15:38:59 +0000 (15:38 +0000)]
Mangle extern "C" functions whose names are not simple identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175166 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix counting of parameters so that r175162 works as expected.
Daniel Jasper [Thu, 14 Feb 2013 15:01:34 +0000 (15:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175165 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReduce penalty for breaking before ./-> after complex calls.
Daniel Jasper [Thu, 14 Feb 2013 14:26:07 +0000 (14:26 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175162 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove a const_cast by propagating constness to called functions
Dmitri Gribenko [Thu, 14 Feb 2013 13:53:30 +0000 (13:53 +0000)]
Remove a const_cast by propagating constness to called functions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175161 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove an unneeded const_cast
Dmitri Gribenko [Thu, 14 Feb 2013 13:49:48 +0000 (13:49 +0000)]
Remove an unneeded const_cast

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175160 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove const_casts by making spec_begin()/spec_end() const
Dmitri Gribenko [Thu, 14 Feb 2013 13:20:36 +0000 (13:20 +0000)]
Remove const_casts by making spec_begin()/spec_end() const

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175159 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove the trailing whitespace of formatted lines.
Daniel Jasper [Thu, 14 Feb 2013 09:58:41 +0000 (09:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175152 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoGet less confused by trailing comma in Google style.
Daniel Jasper [Thu, 14 Feb 2013 09:19:04 +0000 (09:19 +0000)]
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 :-).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175151 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove accidentally committed empty test.
Daniel Jasper [Thu, 14 Feb 2013 08:45:14 +0000 (08:45 +0000)]
Remove accidentally committed empty test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175148 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAlign superclasses for multiple inheritence.
Daniel Jasper [Thu, 14 Feb 2013 08:42:54 +0000 (08:42 +0000)]
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 {
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175147 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRevert accidental commit.
Bill Wendling [Thu, 14 Feb 2013 08:18:53 +0000 (08:18 +0000)]
Revert accidental commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175143 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPass the target options through to code generation.
Bill Wendling [Thu, 14 Feb 2013 08:09:20 +0000 (08:09 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175141 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPartially revert r175117 so that we don't break assumptions about how
Rafael Espindola [Thu, 14 Feb 2013 03:31:26 +0000 (03:31 +0000)]
Partially revert r175117 so that we don't break assumptions about how
static functions in extern "C" contexts are mangled. Should fix the
bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175132 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agomerge hasCLanguageLinkage and isExternC. Keep the shorter name.
Rafael Espindola [Thu, 14 Feb 2013 01:47:04 +0000 (01:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175119 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fix
Rafael Espindola [Thu, 14 Feb 2013 01:18:37 +0000 (01:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175117 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen marking derived classes' virtual methods ODR-used in order to trigger
Nick Lewycky [Thu, 14 Feb 2013 00:55:17 +0000 (00:55 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175116 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTeach ccc-analyze to pass on -iquote with no spaces between it an the argument.
Ted Kremenek [Thu, 14 Feb 2013 00:32:25 +0000 (00:32 +0000)]
Teach ccc-analyze to pass on -iquote with no spaces between it an the argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175115 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoActually fix rendering of the example code block!
Richard Smith [Thu, 14 Feb 2013 00:23:04 +0000 (00:23 +0000)]
Actually fix rendering of the example code block!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175113 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSome grammar fixes to 'Format String Checking', and reorder the text slightly to...
Richard Smith [Thu, 14 Feb 2013 00:22:00 +0000 (00:22 +0000)]
Some grammar fixes to 'Format String Checking', and reorder the text slightly to try to make the final code block actually get rendered.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175112 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDocument Clang's support for [[gnu::...]] attributes.
Richard Smith [Thu, 14 Feb 2013 00:13:34 +0000 (00:13 +0000)]
Document Clang's support for [[gnu::...]] attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175110 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[docs] The stat cache has been removed from the PCH, update the docs to remove mentio...
Argyrios Kyrtzidis [Thu, 14 Feb 2013 00:12:44 +0000 (00:12 +0000)]
[docs] The stat cache has been removed from the PCH, update the docs to remove mentions of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175109 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C: Make order of ivars which are synthesized
Fariborz Jahanian [Wed, 13 Feb 2013 22:50:36 +0000 (22:50 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175100 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove outdated performance.html webpage.
Tanya Lattner [Wed, 13 Feb 2013 21:51:18 +0000 (21:51 +0000)]
Remove outdated performance.html webpage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175090 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Add test case for r175083.
Chad Rosier [Wed, 13 Feb 2013 21:34:54 +0000 (21:34 +0000)]
[ms-inline asm] Add test case for r175083.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175084 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
Richard Smith [Wed, 13 Feb 2013 21:18:23 +0000 (21:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175078 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAllow breaking after the return type in function declarations.
Daniel Jasper [Wed, 13 Feb 2013 20:33:44 +0000 (20:33 +0000)]
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, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<
    T>::aaaaaaa() {}

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175074 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse 'RC_XBS' instead of 'RC_BUILDIT' to catch all times when it's built in the Apple...
Bill Wendling [Wed, 13 Feb 2013 19:44:17 +0000 (19:44 +0000)]
Use 'RC_XBS' instead of 'RC_BUILDIT' to catch all times when it's built in the Apple way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175070 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix comment alignment close to the column limit.
Daniel Jasper [Wed, 13 Feb 2013 19:25:54 +0000 (19:25 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175068 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Fix annotation of a range where the begin or end location
Argyrios Kyrtzidis [Wed, 13 Feb 2013 18:33:28 +0000 (18:33 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175062 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago... and now fix the +Asserts build
Timur Iskhodzhanov [Wed, 13 Feb 2013 12:24:19 +0000 (12:24 +0000)]
... and now fix the +Asserts build

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175054 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix the microsoft-abi-structors test expectations to match both Release and Release...
Timur Iskhodzhanov [Wed, 13 Feb 2013 12:14:25 +0000 (12:14 +0000)]
Fix the microsoft-abi-structors test expectations to match both Release and Release+Asserts builds

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175053 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPull search state out as class members.
Manuel Klimek [Wed, 13 Feb 2013 10:54:19 +0000 (10:54 +0000)]
Pull search state out as class members.

Fix some comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175052 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAn attempt to make the search algorithm easier to understand.
Manuel Klimek [Wed, 13 Feb 2013 10:46:36 +0000 (10:46 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175051 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoEmit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058
Timur Iskhodzhanov [Wed, 13 Feb 2013 08:37:51 +0000 (08:37 +0000)]
Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175045 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: And more cast tests (these don't pass yet).
Nico Weber [Wed, 13 Feb 2013 04:40:03 +0000 (04:40 +0000)]
Formatter: And more cast tests (these don't pass yet).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175031 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Add more cast tests.
Nico Weber [Wed, 13 Feb 2013 04:32:57 +0000 (04:32 +0000)]
Formatter: Add more cast tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175030 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Refactor the cast detection code to be a bit more readable.
Nico Weber [Wed, 13 Feb 2013 04:13:13 +0000 (04:13 +0000)]
Formatter: Refactor the cast detection code to be a bit more readable.

No functionality change. Also add another cast test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175029 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Detect ObjC method expressions after casts.
Nico Weber [Wed, 13 Feb 2013 03:48:27 +0000 (03:48 +0000)]
Formatter: Detect ObjC method expressions after casts.

Not all casts are correctly detected yet, but it helps in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175028 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoChange this comment to helpfully explain why it's there.
Nick Lewycky [Wed, 13 Feb 2013 03:34:21 +0000 (03:34 +0000)]
Change this comment to helpfully explain why it's there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175027 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Use Clang's evaluation for global constants and default arguments.
Jordan Rose [Wed, 13 Feb 2013 03:11:06 +0000 (03:11 +0000)]
[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>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175026 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Use makeZeroVal in RegionStore's lazy evaluation of statics.
Jordan Rose [Wed, 13 Feb 2013 03:11:01 +0000 (03:11 +0000)]
[analyzer] Use makeZeroVal in RegionStore's lazy evaluation of statics.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175025 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline-asm] Test cases to ensure the AsmRewrite list is sorted (r175021).
Chad Rosier [Wed, 13 Feb 2013 01:06:08 +0000 (01:06 +0000)]
[ms-inline-asm] Test cases to ensure the AsmRewrite list is sorted (r175021).
Part of rdar://13202662

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175022 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoOrder the methods in the global method pool based on when they become visible, not...
Douglas Gregor [Tue, 12 Feb 2013 23:36:21 +0000 (23:36 +0000)]
Order the methods in the global method pool based on when they become visible, not when they become deserialized <rdar://problem/13203033>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175018 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReplace 'signed' with 'int'. 'signed' is not typical for LLVM style
Dmitri Gribenko [Tue, 12 Feb 2013 22:40:22 +0000 (22:40 +0000)]
Replace 'signed' with 'int'.  'signed' is not typical for LLVM style

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175015 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[preprocessing record] Add some sanity checks for the preprocessed entity index
Argyrios Kyrtzidis [Tue, 12 Feb 2013 21:41:23 +0000 (21:41 +0000)]
[preprocessing record] Add some sanity checks for the preprocessed entity index
to make sure we don't crash on release if the index is not valid.

rdar://13089714

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175010 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline-asm] Add test cases for the align/emit directives.
Chad Rosier [Tue, 12 Feb 2013 21:34:14 +0000 (21:34 +0000)]
[ms-inline-asm] Add test cases for the align/emit directives.
Part of rdar://13200215

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175009 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd a test for r174980, that we used to accept
Dmitri Gribenko [Tue, 12 Feb 2013 20:43:41 +0000 (20:43 +0000)]
Add a test for r174980, that we used to accept

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175005 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix crash for incomplete labels in macros.
Daniel Jasper [Tue, 12 Feb 2013 20:17:17 +0000 (20:17 +0000)]
Fix crash for incomplete labels in macros.

Still the formatting can be improved, but at least we don't assert any
more. This happened when trying to format lib/Sema/SemaType.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175003 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Update test case now that we are correctly parsing __emit directives.
Chad Rosier [Tue, 12 Feb 2013 19:42:57 +0000 (19:42 +0000)]
[ms-inline asm] Update test case now that we are correctly parsing __emit directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175000 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixing the MSVC compiler warning a different way; removed use of static_cast and...
Aaron Ballman [Tue, 12 Feb 2013 19:20:48 +0000 (19:20 +0000)]
Fixing the MSVC compiler warning a different way; removed use of static_cast and instead used a signed integer parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174996 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTypo.
Chad Rosier [Tue, 12 Feb 2013 19:15:05 +0000 (19:15 +0000)]
Typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174995 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[ms-inline asm] Add a few test cases for the parsing of hexidecimal integers.
Chad Rosier [Tue, 12 Feb 2013 18:45:21 +0000 (18:45 +0000)]
[ms-inline asm] Add a few test cases for the parsing of hexidecimal integers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174989 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemoving a signed/unsigned mismatch warning triggered in MSVC 11.
Aaron Ballman [Tue, 12 Feb 2013 18:39:15 +0000 (18:39 +0000)]
Removing a signed/unsigned mismatch warning triggered in MSVC 11.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174986 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAccept over-qualified constructor in MSVC emulation mode
Dmitri Gribenko [Tue, 12 Feb 2013 17:27:41 +0000 (17:27 +0000)]
Accept over-qualified constructor in MSVC emulation mode

MSVC accepts this:

class A {
  A::A();
};

Clang accepts regular member functions with extra qualification as an MS
extension, but not constructors.  This changes the parser to defer rejecting
qualified constructors so that the same Sema logic can apply to constructors as
regular member functions.  This also improves the error message when MS
extensions are disabled (in my opinion). Before it was:

/Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers
  A::A();
  ~~~~ ^
1 error generated.

After:

/Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A'
  A::A();
  ~~~^
1 error generated.

Patch by Jason Haslam.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174980 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix bug in the adjustment to existing lines.
Daniel Jasper [Tue, 12 Feb 2013 16:51:23 +0000 (16:51 +0000)]
Fix bug in the adjustment to existing lines.

Before (if only the second line was reformatted):
void f() {}
          void g() {}

After:
void f() {}
void g() {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174978 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Correctly format stars in `sizeof(int**)` and similar places.
Nico Weber [Tue, 12 Feb 2013 16:17:07 +0000 (16:17 +0000)]
Formatter: Correctly format stars in `sizeof(int**)` and similar places.

This redoes how '*' and '&' are classified as pointer / reference markers when
followed by ')', '>', or ','.

Previously, determineStarAmpUsage() marked a single '*' and '&' followed by
')', '>', or ',' as pointer or reference marker. Now, all '*'s and '&'s
preceding ')', '>', or ',' are marked as pointer / reference markers. Fixes
PR14884.

Since only the last '*' in 'int ***' was marked as pointer before (the rest
were unary operators, which don't reach spaceRequiredBetween()),
spaceRequiredBetween() now had to be thought about handing multiple '*'s in
sequence.

Before:
  return sizeof(int * *);
  Type **A = static_cast<Type * *>(P);

Now:
  return sizeof(int**);
  Type **A = static_cast<Type **>(P);

While here, also make all methods of AnnotatingParser except parseLine()
private.

Review URL: http://llvm-reviews.chandlerc.com/D384

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174975 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdding more overloads for allOf matcher
Edwin Vane [Tue, 12 Feb 2013 13:55:40 +0000 (13:55 +0000)]
Adding more overloads for allOf matcher

Adding overloads of allOf accepting 4 and 5 arguments.

Reviewer: klimek

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174967 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRename -constructors test to just -structors as in fact it tests dtors too. Also...
Timur Iskhodzhanov [Tue, 12 Feb 2013 13:22:47 +0000 (13:22 +0000)]
Rename -constructors test to just -structors as in fact it tests dtors too. Also, fix a minor typo in the test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174966 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAttempt to fix this test on i686 targets.
Nick Lewycky [Tue, 12 Feb 2013 08:59:01 +0000 (08:59 +0000)]
Attempt to fix this test on i686 targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174953 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThe meat of this patch is in BuildCXXMemberCalLExpr where we make it use
Nick Lewycky [Tue, 12 Feb 2013 08:08:54 +0000 (08:08 +0000)]
The meat of this patch is in BuildCXXMemberCalLExpr where we make it use
MarkMemberReferenced instead of marking functions referenced directly. An audit
of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few
other changes:
 * don't mark functions odr-used when considering them for an initialization
   sequence. Do mark them referenced though.
 * the function nominated by the cleanup attribute should be diagnosed.
 * operator new/delete should be diagnosed when building a 'new' expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174951 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoProperly assemble PHIs after a null-checked invoke of objc_msgSend.
John McCall [Tue, 12 Feb 2013 05:53:35 +0000 (05:53 +0000)]
Properly assemble PHIs after a null-checked invoke of objc_msgSend.
rdar://12046763

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174946 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix a bug reduced from a crash when trying to use modules with libc++. We check
Richard Smith [Tue, 12 Feb 2013 05:48:23 +0000 (05:48 +0000)]
Fix a bug reduced from a crash when trying to use modules with libc++. We check
the linkage of functions and variables while merging declarations from modules,
and we don't necessarily have enough of the rest of the AST loaded at that
point to allow us to compute linkage, so serialize it instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174943 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago+ specified progress information
Anton Yartsev [Tue, 12 Feb 2013 05:02:54 +0000 (05:02 +0000)]
+ specified progress information

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174942 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago+ centered progress cells
Anton Yartsev [Tue, 12 Feb 2013 04:45:48 +0000 (04:45 +0000)]
+ centered progress cells
+ added progress information for several checkers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174941 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCall __cxa_begin_catch with the current exception before
John McCall [Tue, 12 Feb 2013 03:51:46 +0000 (03:51 +0000)]
Call __cxa_begin_catch with the current exception before
calling std::terminate().  rdar://11904428

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174940 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoChange some CGF parameters to CGMs.
John McCall [Tue, 12 Feb 2013 03:51:38 +0000 (03:51 +0000)]
Change some CGF parameters to CGMs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174939 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRemove an assert which triggers when a decl context in a module hits the 'has
Richard Smith [Tue, 12 Feb 2013 02:32:35 +0000 (02:32 +0000)]
Remove an assert which triggers when a decl context in a module hits the 'has
lexical storage but not visible storage' case in C++. It's unclear whether we
even need the special-case handling for C++, since it seems to be working
around our not serializing a lookup table for the TU in C. But in any case,
the assertion is incorrect.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174931 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPerform placeholder conversions on the controller of a _Generic
John McCall [Tue, 12 Feb 2013 02:08:12 +0000 (02:08 +0000)]
Perform placeholder conversions on the controller of a _Generic
expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174930 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDiagnose loads of 'half' l-values in OpenCL.
John McCall [Tue, 12 Feb 2013 01:29:43 +0000 (01:29 +0000)]
Diagnose loads of 'half' l-values in OpenCL.
Patch by Joey Gouly!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174928 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoBacking out r174919 while I investigate a self-host bug on Takumi's builder.
Lang Hames [Tue, 12 Feb 2013 00:44:43 +0000 (00:44 +0000)]
Backing out r174919 while I investigate a self-host bug on Takumi's builder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174925 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoIn ARC, emit non-peepholed +1s within the full-expression instead
John McCall [Tue, 12 Feb 2013 00:25:08 +0000 (00:25 +0000)]
In ARC, emit non-peepholed +1s within the full-expression instead
of immediately afterwards.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174922 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoSplit a couple of tests out into their own file.
John McCall [Tue, 12 Feb 2013 00:25:02 +0000 (00:25 +0000)]
Split a couple of tests out into their own file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174921 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen generating IR for default copy-constructors, copy-assignment operators,
Lang Hames [Mon, 11 Feb 2013 23:44:11 +0000 (23:44 +0000)]
When generating IR for default copy-constructors, copy-assignment operators,
move-constructors and move-assignment operators, use memcpy to copy adjacent
POD members.

Previously, classes with one or more Non-POD members would fall back on
element-wise copies for all members, including POD members. This often
generated a lot of IR. Without padding metadata, it wasn't often possible
for the LLVM optimizers to turn the element-wise copies into a memcpy.

This code hasn't yet received any serious tuning. I didn't see any serious
regressions on a self-hosted clang build, or any of the nightly tests, but
I think it's important to get this out in the wild to get more testing.
Insights, feedback and comments welcome.

Many thanks to David Blaikie, Richard Smith, and especially John McCall for
their help and feedback on this work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174919 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTiming data was removed years ago. Remove these links.
Tanya Lattner [Mon, 11 Feb 2013 23:32:10 +0000 (23:32 +0000)]
Timing data was removed years ago. Remove these links.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174918 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't bother reconciling external visible decls against our current set of
Richard Smith [Mon, 11 Feb 2013 22:02:16 +0000 (22:02 +0000)]
Don't bother reconciling external visible decls against our current set of
declarations if we didn't have a lookup map when the external decls were added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174906 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C modern translator: Fixes a mistranslation
Fariborz Jahanian [Mon, 11 Feb 2013 19:30:33 +0000 (19:30 +0000)]
objective-C modern translator: Fixes a mistranslation
of @throw statement by finding location of the ';'
correctly. // rdar://13186010

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174898 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[Modules] Cope better with top-level declarations loaded after being declared in...
Douglas Gregor [Mon, 11 Feb 2013 18:16:18 +0000 (18:16 +0000)]
[Modules] Cope better with top-level declarations loaded after being declared in the current translation unit <rdar://problem/13189985>.

These two related tweaks to keep the information associated with a
given identifier correct when the identifier has been given some
top-level information (say, a top-level declaration) and more
information is then loaded from a module. The first ensures that an
identifier that was "interesting" before being loaded from an AST is
considered to be different from its on-disk counterpart. Otherwise, we
lose such changes when writing the current translation unit as a
module.

Second, teach the code that injects AST-loaded names into the
identifier chain for name lookup to keep the most recent declaration,
so that we don't end up confusing our declaration chains by having a
different declaration in there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174895 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Detect ObjC message expressions after 'in' in loop
Nico Weber [Mon, 11 Feb 2013 15:32:15 +0000 (15:32 +0000)]
Formatter: Detect ObjC message expressions after 'in' in loop

Before:
  for (id foo in[self getStuffFor : bla]) {
  }

Now:
  for (id foo in [self getStuffFor:bla]) {
  }

"in" is treated as loop keyword if the line starts with "for", and as a
regular identifier else. To check for "in", its IdentifierInfo is handed
through a few layers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174889 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoGet rid of manual debug output, now that the test runner supports it.
Manuel Klimek [Mon, 11 Feb 2013 12:37:30 +0000 (12:37 +0000)]
Get rid of manual debug output, now that the test runner supports it.

You can run tests with -debug instead now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174880 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix invalid formatting with spaces before trailing comments.
Daniel Jasper [Mon, 11 Feb 2013 12:36:37 +0000 (12:36 +0000)]
Fix invalid formatting with spaces before trailing comments.

In google style, trailing comments are separated by two spaces. This
patch fixes the counting of these spaces and prevents clang-format from
creating a line with 81 columns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174879 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFixes handling of empty lines in macros.
Manuel Klimek [Mon, 11 Feb 2013 12:33:24 +0000 (12:33 +0000)]
Fixes handling of empty lines in macros.

Now correctly formats:
 #define A \
   \
   b;
to
 #define A b;

Added the state whether an unwrapped line is a macro to the debug
output.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174878 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUpdate test to not fail with attribute groups.
Bill Wendling [Mon, 11 Feb 2013 08:35:52 +0000 (08:35 +0000)]
Update test to not fail with attribute groups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174866 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix formatting of overloaded operator definitions.
Daniel Jasper [Mon, 11 Feb 2013 08:01:18 +0000 (08:01 +0000)]
Fix formatting of overloaded operator definitions.

Before:
operatorvoid*();
operator vector< A< A>>();

After:
operator void *();
operator vector<A<A> >();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174863 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDo not use VariadicDynCastAllOfMatcher where VariadicAllOfMatcher works.
Manuel Klimek [Mon, 11 Feb 2013 07:45:01 +0000 (07:45 +0000)]
Do not use VariadicDynCastAllOfMatcher where VariadicAllOfMatcher works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174862 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Remove now-unneeded code for formatting ':'s in ObjC method decls.
Nico Weber [Sun, 10 Feb 2013 21:08:31 +0000 (21:08 +0000)]
Formatter: Remove now-unneeded code for formatting ':'s in ObjC method decls.

The more general code for formatting ObjC method exprs does this and more,
it's no longer necessary to special-case this. No behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174843 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Add a test for multi-line ObjC dict literals.
Nico Weber [Sun, 10 Feb 2013 20:48:24 +0000 (20:48 +0000)]
Formatter: Add a test for multi-line ObjC dict literals.

As it turns out, this already works reasonably well.

This example from http://clang.llvm.org/docs/ObjectiveCLiterals.html
NSDictionary *dictionary = @{
    @"name" : NSUserName(),
    @"date" : [NSDate date],
    @"processInfo" : [NSProcessInfo processInfo]
};

is formatted like
NSDictionary *dictionary = @{ @"name" : NSUserName(), @"date" : [NSDate date],
                              @"processInfo" : [NSProcessInfo processInfo] };

There's already a FIXME in NestedStaticInitializers about supporting one
initializer per line, which is really all that's missing here too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174842 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Add another ObjC literal test.
Nico Weber [Sun, 10 Feb 2013 20:39:05 +0000 (20:39 +0000)]
Formatter: Add another ObjC literal test.

(From http://clang.llvm.org/docs/ObjectiveCLiterals.html.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174841 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Initial support for ObjC dictionary literals.
Nico Weber [Sun, 10 Feb 2013 20:35:35 +0000 (20:35 +0000)]
Formatter: Initial support for ObjC dictionary literals.

Before:
  @{
  foo:
    bar
  }
  ;

Now:
  @{ foo : bar };

parseBracedList() already does the right thing from an UnwrappedLineParser
perspective, so check for "@{" in all loops that process constructs that can
contain expressions and call parseBracedList() if found.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174840 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse -mno-implicit-float by default for kernel/kext code. <rdar://13177960>
Bob Wilson [Sun, 10 Feb 2013 16:01:41 +0000 (16:01 +0000)]
Use -mno-implicit-float by default for kernel/kext code. <rdar://13177960>

Apple's kernel engineers have been expecting this behavior even though
we've never implemented it before, as far as I can tell. In recent months,
clang has gotten better at using vector instructions to optimize memcpy-like
operations, and that has exposed problems when vector/floating-point
instructions are used in kexts that don't support that. This behavior also
matches what Apple's GCC did for PowerPC targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174838 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDelete an extra blank line.
Bob Wilson [Sun, 10 Feb 2013 16:01:38 +0000 (16:01 +0000)]
Delete an extra blank line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174837 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoRecognize -mno-implicit-float option for x86 as well as ARM. <rdar://13180731>
Bob Wilson [Sun, 10 Feb 2013 15:25:44 +0000 (15:25 +0000)]
Recognize -mno-implicit-float option for x86 as well as ARM. <rdar://13180731>

For x86 targets, we've been using the -msoft-float option to control passing
the no-implicit-float option to cc1. Since the -mno-implicit-float option is
now accepted by the driver, this just makes it work for x86 the same as it
does for ARM targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174836 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoUse static functions instead of an unnamed namespace
Dmitri Gribenko [Sun, 10 Feb 2013 11:54:22 +0000 (11:54 +0000)]
Use static functions instead of an unnamed namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174835 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoReformat formatter code. No functionality change.
Nico Weber [Sun, 10 Feb 2013 04:38:23 +0000 (04:38 +0000)]
Reformat formatter code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174823 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Detect ObjC array literals.
Nico Weber [Sun, 10 Feb 2013 02:08:05 +0000 (02:08 +0000)]
Formatter: Detect ObjC array literals.

Use this to add a space after "@[" and before "]" for now.

Later, I want to use this to format multi-line array literals nicer, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174822 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoobjective-C: Fixes a bogus warning due to not setting
Fariborz Jahanian [Sun, 10 Feb 2013 00:16:04 +0000 (00:16 +0000)]
objective-C: Fixes a bogus warning due to not setting
the "nonatomic" attribute in property redeclaration
in class extension. Also, improved on diagnostics in
this area while at it. // rdar://13156292

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174821 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFormatter: Add test for default arguments.
Nico Weber [Sat, 9 Feb 2013 18:02:07 +0000 (18:02 +0000)]
Formatter: Add test for default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174816 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFileCheck'ize tests
Dmitri Gribenko [Sat, 9 Feb 2013 16:41:47 +0000 (16:41 +0000)]
FileCheck'ize tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174815 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFileCheck'ize a test
Dmitri Gribenko [Sat, 9 Feb 2013 16:25:38 +0000 (16:25 +0000)]
FileCheck'ize a test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174814 91177308-0d34-0410-b5e6-96231b3b80d8