]> granicus.if.org Git - clang/log
clang
9 years agoMS ABI: Emit dynamic initializers for selectany globals in comdat-associative section...
Hans Wennborg [Wed, 10 Sep 2014 19:28:48 +0000 (19:28 +0000)]
MS ABI: Emit dynamic initializers for selectany globals in comdat-associative sections (PR20889)

This prevents initializers for comdat-folded globals from running multiple times.

Differential Revision: http://reviews.llvm.org/D5281

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

9 years agoObjective-C arc. Fixes a crash when issuing diagnostic for
Fariborz Jahanian [Wed, 10 Sep 2014 18:23:34 +0000 (18:23 +0000)]
Objective-C arc. Fixes a crash when issuing diagnostic for
passing parameter to an audited CF API. rdar://18222007

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

9 years ago[sphinx cleanup]
Dan Liew [Wed, 10 Sep 2014 17:26:21 +0000 (17:26 +0000)]
[sphinx cleanup]
Fix sphinx warning introduced by r217501.

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

9 years agoRecognize .lib files as linker input explicitly
Ehsan Akhgari [Wed, 10 Sep 2014 17:15:00 +0000 (17:15 +0000)]
Recognize .lib files as linker input explicitly

Summary:
Currently, this is done implicitly in Driver::BuildInputs by considering
any invalid input type as linker input.

Test Plan: I don't think this behavior is observable for the reason stated above.

Reviewers: hansw

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5294

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

9 years agoAdd a test for an operator access decl.
Nico Weber [Wed, 10 Sep 2014 17:03:37 +0000 (17:03 +0000)]
Add a test for an operator access decl.

In Parser::ParseCXXClassMemberDeclaration(), it was possible to change
      isAccessDecl = NextToken().is(tok::kw_operator);
to
      isAccessDecl = false;
and no tests would fail. Now there's coverage for this.

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

9 years agotypo
Sanjay Patel [Wed, 10 Sep 2014 16:59:01 +0000 (16:59 +0000)]
typo

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

9 years ago[analyzer] Fix pthread lock tests so that the API comes from a system header.
Jordan Rose [Wed, 10 Sep 2014 16:17:42 +0000 (16:17 +0000)]
[analyzer] Fix pthread lock tests so that the API comes from a system header.

...and verify that a global mutex in user code can be used without warnings.

Patch by Aleksei Sidorin!

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

9 years agoclang-format: Add option to allow short case labels on a single line.
Daniel Jasper [Wed, 10 Sep 2014 13:11:45 +0000 (13:11 +0000)]
clang-format: Add option to allow short case labels on a single line.

On a single line:
  switch (a) {
  case 1: x = 1; return;
  case 2: x = 2; return;
  default: break;
  }

Not on a single line:
  switch (a) {
  case 1:
    x = 1;
    return;
  case 2:
    x = 2;
    return;
  default:
    break;
  }

This partly addresses llvm.org/PR16535. In the long run, we probably want to
lay these out in columns.

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

9 years agoCodeGen: Use a fixed alignment for vtables.
Benjamin Kramer [Wed, 10 Sep 2014 12:50:59 +0000 (12:50 +0000)]
CodeGen: Use a fixed alignment for vtables.

Pointer-sized alignment is sufficient as we only ever read single values
from the table. Otherwise we'd bump the alignment to 16 bytes in the
backend if the vtable is larger than 16 bytes. This is great for
structures that are accessed with vector instructions or copied around, but
that's simply not the case for vtables.

Shrinks the data segment of a Release x86_64 clang by 0.3%. The wins are
larger for i386 and code bases that use vtables more often than we do.

This matches the behavior of GCC 5.

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

9 years agoRevert over-eager unique_ptr conversion.
Benjamin Kramer [Wed, 10 Sep 2014 09:35:49 +0000 (09:35 +0000)]
Revert over-eager unique_ptr conversion.

This test wants to observe PPCallbacks after they have been moved into the
preprocessor. That doesn't work if the pointer has been moved away.

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

9 years agoUnique_ptrify PPCallbacks ownership.
Craig Topper [Wed, 10 Sep 2014 04:53:53 +0000 (04:53 +0000)]
Unique_ptrify PPCallbacks ownership.

Unique_ptr creation stil needs to be moved earlier at some of the call sites.

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

9 years agoDon't crash on access decls with invalid scope specifier, PR20887.
Nico Weber [Wed, 10 Sep 2014 00:59:37 +0000 (00:59 +0000)]
Don't crash on access decls with invalid scope specifier, PR20887.

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

9 years agoObjective-C. Under a special flag, -Wcstring-format-directive,
Fariborz Jahanian [Tue, 9 Sep 2014 23:10:54 +0000 (23:10 +0000)]
Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used in
certain CF/NS formatting APIs, to assist user in deprecating
use of such %s in these APIs. rdar://18182443

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

9 years agoTeach the analyzer that __builtin_assume_aligned returns its first argument.
Jordan Rose [Tue, 9 Sep 2014 21:42:16 +0000 (21:42 +0000)]
Teach the analyzer that __builtin_assume_aligned returns its first argument.

Patch by Daniel Fahlgren!

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

9 years agoclang-format: [JS] Support regex literals with trailing escaped slash.
Daniel Jasper [Tue, 9 Sep 2014 14:37:39 +0000 (14:37 +0000)]
clang-format: [JS] Support regex literals with trailing escaped slash.

Before:
  var regex = / a\//; int i;

After:
  var regex = /a\//;
  int i;

This required pushing the Lexer into its wrapper class and generating a
new one in this specific case. Otherwise, the sequence get lexed as a
//-comment. This is hacky, but I don't know a better way (short of
supporting regex literals in the Lexer).

Pushing the Lexer down seems to make all the call sites simpler.

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

9 years agoTooling: Ignore file names in tooling::deduplicate.
Benjamin Kramer [Tue, 9 Sep 2014 13:53:29 +0000 (13:53 +0000)]
Tooling: Ignore file names in tooling::deduplicate.

This was horribly broken due to how the sort predicate works. We would
report a conflict for files with a replacement in the same position but
different names if the length differed. Just ignore paths as this is often
what the user wants. Files can occur with different names (due to symlinks
or relative paths) and we don't ever want to do the same edit in one file
twice.

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

9 years agoAllow empty statements in naked functions in addition to ASM statements
Ehsan Akhgari [Tue, 9 Sep 2014 02:49:40 +0000 (02:49 +0000)]
Allow empty statements in naked functions in addition to ASM statements

Summary: This fixes PR20883.

Test Plan: The patch includes an automated test.

Reviewers: hansw

Differential Revision: http://reviews.llvm.org/D5256

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

9 years agoFix PCHs that import more than one module
Ben Langmuir [Mon, 8 Sep 2014 20:36:26 +0000 (20:36 +0000)]
Fix PCHs that import more than one module

We were passing < to std::unique, but it expects ==. Since the input is
sorted, we were always trimming it to one entry.

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

9 years agoReport source location of returns_nonnull attribute in UBSan reports.
Alexey Samsonov [Mon, 8 Sep 2014 20:17:19 +0000 (20:17 +0000)]
Report source location of returns_nonnull attribute in UBSan reports.

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

9 years agoImplement nonnull-attribute sanitizer
Alexey Samsonov [Mon, 8 Sep 2014 17:22:45 +0000 (17:22 +0000)]
Implement nonnull-attribute sanitizer

Summary:
This patch implements a new UBSan check, which verifies
that function arguments declared to be nonnull with __attribute__((nonnull))
are actually nonnull in runtime.

To implement this check, we pass FunctionDecl to CodeGenFunction::EmitCallArgs
(where applicable) and if function declaration has nonnull attribute specified
for a certain formal parameter, we compare the corresponding RValue to null as
soon as it's calculated.

Test Plan: regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, rnk

Differential Revision: http://reviews.llvm.org/D5082

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

9 years agoRemove a parameter that has been unused since r188481. No behavior change.
Nico Weber [Mon, 8 Sep 2014 16:26:36 +0000 (16:26 +0000)]
Remove a parameter that has been unused since r188481. No behavior change.

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

9 years agoMake FileEntry::getName() valid across calls to FileManager::getFile()
Ben Langmuir [Mon, 8 Sep 2014 16:15:54 +0000 (16:15 +0000)]
Make FileEntry::getName() valid across calls to FileManager::getFile()

Because we may change the name of a FileEntry inside getFile, the name
returned by FileEntry::getName() could be destroyed.  This was causing a
use-after-free when searching the HeaderFileInfo on-disk hashtable for a
module or pch.

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

9 years agoAdd a comment for something that confused me.
Nico Weber [Mon, 8 Sep 2014 16:11:15 +0000 (16:11 +0000)]
Add a comment for something that confused me.

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

9 years agoHandle constructors and destructors a bit more uniformly in CodeGen.
Rafael Espindola [Mon, 8 Sep 2014 16:01:27 +0000 (16:01 +0000)]
Handle constructors and destructors a bit more uniformly in CodeGen.

There were code paths that are duplicated for constructors and destructors just
because we have both CXXCtorType and CXXDtorsTypes.

This patch introduces an unified enum and reduces code deplication a bit.

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

9 years agoAdd .clang-tidy configuration file to provide LLVM-optimized defaults for clang-tidy.
Alexander Kornienko [Mon, 8 Sep 2014 13:33:32 +0000 (13:33 +0000)]
Add .clang-tidy configuration file to provide LLVM-optimized defaults for clang-tidy.

Reviewers: chandlerc, djasper, alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5237

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

9 years agoclang/test/CodeGen/builtin-assume*.c: Fixup for -Asserts.
NAKAMURA Takumi [Mon, 8 Sep 2014 01:12:55 +0000 (01:12 +0000)]
clang/test/CodeGen/builtin-assume*.c: Fixup for -Asserts.

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

9 years agoDon't test really-large alignments for now
Hal Finkel [Mon, 8 Sep 2014 00:09:15 +0000 (00:09 +0000)]
Don't test really-large alignments for now

Temporarily comment out the test for really-large powers of two. This seems to
be host-sensitive for some reason... trying to fix the clang-i386-freebsd
builder.

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

9 years agoAdd __builtin_assume and __builtin_assume_aligned using @llvm.assume.
Hal Finkel [Sun, 7 Sep 2014 22:58:14 +0000 (22:58 +0000)]
Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.

This makes use of the recently-added @llvm.assume intrinsic to implement a
__builtin_assume(bool) intrinsic (to provide additional information to the
optimizer). This hooks up __assume in MS-compatibility mode to mirror
__builtin_assume (the semantics have been intentionally kept compatible), and
implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM
now contains special logic to deal with assumptions of this form.

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

9 years agoAdjust test/CodeGenCXX/pr12251.cpp
Hal Finkel [Sun, 7 Sep 2014 21:28:53 +0000 (21:28 +0000)]
Adjust test/CodeGenCXX/pr12251.cpp

InstCombine just got a bit smarter about checking known bits of returned
values, and because this test runs the optimizer, it requires an update. We
should really rewrite this test to directly check the IR output from CodeGen.

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

9 years agoAvoid writing to the test directory as it may not be writable.
David Blaikie [Sun, 7 Sep 2014 17:34:18 +0000 (17:34 +0000)]
Avoid writing to the test directory as it may not be writable.

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

9 years agoFix test to not write output to the test directory, as it may not be writable.
David Blaikie [Sun, 7 Sep 2014 16:59:13 +0000 (16:59 +0000)]
Fix test to not write output to the test directory, as it may not be writable.

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

9 years agoTry to green test/Sema/format-strings.c on Win bots
Hans Wennborg [Sun, 7 Sep 2014 04:03:21 +0000 (04:03 +0000)]
Try to green test/Sema/format-strings.c on Win bots

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

9 years agoMS format strings: parse the 'Z' printf conversion specifier (PR20808)
Hans Wennborg [Sun, 7 Sep 2014 03:03:51 +0000 (03:03 +0000)]
MS format strings: parse the 'Z' printf conversion specifier (PR20808)

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

9 years agoMove x86-specific bits of warn-unused-local-typedef.cpp into their own file.
Nico Weber [Sat, 6 Sep 2014 18:16:37 +0000 (18:16 +0000)]
Move x86-specific bits of warn-unused-local-typedef.cpp into their own file.

That way, most of the test can run everywhere. Also give the new file an x86
triple in addition to a REQUIRES line.

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

9 years agoAttempt to fix ARM bot. (The test references a typedef from x86 asm.)
Nico Weber [Sat, 6 Sep 2014 15:48:53 +0000 (15:48 +0000)]
Attempt to fix ARM bot. (The test references a typedef from x86 asm.)

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

9 years ago[x86] Clean up the x86 builtin specs to reflect r217310 in LLVM which
Chandler Carruth [Sat, 6 Sep 2014 10:30:51 +0000 (10:30 +0000)]
[x86] Clean up the x86 builtin specs to reflect r217310 in LLVM which
made the 8-bit masks actually 8-bit arguments to these intrinsics.

These builtins are a mess. Many were missing the I qualifier which
I added where obviously correct. Most aren't tested, but I've updated
the relevant tests. I've tried to catch all the things that should
become 'c' in this round.

It's also frustrating because the set of these is really ad-hoc and
doesn't really map that cleanly to the set supported by either GCC or
LLVM. Oh well...

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

9 years agoAdd error, recovery and fixit for "~A::A() {...}".
Richard Smith [Sat, 6 Sep 2014 02:06:12 +0000 (02:06 +0000)]
Add error, recovery and fixit for "~A::A() {...}".

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

9 years agoAdd -Wunused-local-typedef, a warning that finds unused local typedefs.
Nico Weber [Sat, 6 Sep 2014 01:25:55 +0000 (01:25 +0000)]
Add -Wunused-local-typedef, a warning that finds unused local typedefs.

The warning warns on TypedefNameDecls -- typedefs and C++11 using aliases --
that are !isReferenced(). Since the isReferenced() bit on TypedefNameDecls
wasn't used for anything before this warning it wasn't always set correctly,
so this patch also adds a few missing MarkAnyDeclReferenced() calls in
various places for TypedefNameDecls.

This is made a bit complicated due to local typedefs possibly being used only
after their local scope has closed. Consider:

    template <class T>
    void template_fun(T t) {
      typename T::Foo s3foo;  // YYY
      (void)s3foo;
    }
    void template_fun_user() {
      struct Local {
        typedef int Foo;  // XXX
      } p;
      template_fun(p);
    }

Here the typedef in XXX is only used at end-of-translation unit, when YYY in
template_fun() gets instantiated. To handle this, typedefs that are unused when
their scope exits are added to a set of potentially unused typedefs, and that
set gets checked at end-of-TU. Typedefs that are still unused at that point then
get warned on. There's also serialization code for this set, so that the
warning works with precompiled headers and modules. For modules, the warning
is emitted when the module is built, for precompiled headers each time the
header gets used.

Finally, consider a function using C++14 auto return types to return a local
type defined in a header:

    auto f() {
      struct S { typedef int a; };
      return S();
    }

Here, the typedef escapes its local scope and could be used by only some
translation units including the header. To not warn on this, add a
RecursiveASTVisitor that marks all delcs on local types returned from auto
functions as referenced. (Except if it's a function with internal linkage, or
the decls are private and the local type has no friends -- in these cases, it
_is_ safe to warn.)

Several of the included testcases (most of the interesting ones) were provided
by Richard Smith.

(gcc's spelling -Wunused-local-typedefs is supported as an alias for this
warning.)

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

9 years agoReword switch/goto diagnostics "protected scope" diagnostics. Making up a term
Richard Smith [Sat, 6 Sep 2014 00:24:58 +0000 (00:24 +0000)]
Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.

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

9 years agoFix r217275 to work without the need for standard headers being included
David Blaikie [Fri, 5 Sep 2014 23:36:59 +0000 (23:36 +0000)]
Fix r217275 to work without the need for standard headers being included

It seems (I guess) in ObjC that va_list is provided without the need for
inclusions. I verified that with this change the test still crashes in
the absence of the fix committed in r217275.

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

9 years agoMove the initialization of VAListTagName after InitializeSema()
Ben Langmuir [Fri, 5 Sep 2014 20:24:27 +0000 (20:24 +0000)]
Move the initialization of VAListTagName after InitializeSema()

This innocuous statement to get the identifier info for __va_list_tag
was causing an assertion failure:
  NextIsPrevious() && "decl became non-canonical unexpectedly"
if the __va_list_tag identifier was found in a PCH in some
circumstances, because it was looked up before the ASTReader had a Sema
object to use to find existing decls to merge with.

We could possibly move getting the identifier info even later, or make
it lazy if we wanted to, but this seemed like the minimal change.

Now why a PCH would have this identifier in the first place is a bit
mysterious. This seems to be related to the global module index in some
way, because when the test case is built without the global module index
it will not emit an identifier for __va_list_tag into the PCH, but with
the global module index it does.

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

9 years agoSeparate the matchers by type and statically dispatch to the right list.
Samuel Benzaquen [Fri, 5 Sep 2014 20:15:31 +0000 (20:15 +0000)]
Separate the matchers by type and statically dispatch to the right list.

Summary:
Separate the matchers by type and statically dispatch to the right list.
For any node type that we support, it reduces the number of matchers we
run it through.
For node types we do not support, it makes match() a noop.
This change improves our clang-tidy related benchmark by ~30%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5197

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

9 years agoRequire an x86 target for ms-inline-asm-return.cpp instead of XFAIL
Reid Kleckner [Fri, 5 Sep 2014 20:06:06 +0000 (20:06 +0000)]
Require an x86 target for ms-inline-asm-return.cpp instead of XFAIL

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

9 years ago-frewrite-includes: Normalize line endings to match the main source file
Reid Kleckner [Fri, 5 Sep 2014 16:49:50 +0000 (16:49 +0000)]
-frewrite-includes: Normalize line endings to match the main source file

It is very common to include headers with DOS-style line endings, such
as windows.h, from source files with Unix-style line endings.
Previously, we would end up with mixed line endings and #endifs that
appeared to be on the same line:

  #if 0 /* expanded by -frewrite-includes */
  #include <windows.h>^M#endif /* expanded by -frewrite-includes */

Clang treats either of \r or \n as a line ending character, so this is
purely a cosmetic issue.

This has no automated test because most Unix tools on Windows will
implictly convert CRLF to LF when reading files, making it very hard to
detect line ending mismatches. FileCheck doesn't understand {{\r}}
either.

Fixes PR20552.

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

9 years ago[analyzer] Don't crash if malloc() has an unexpected function prototype.
Jordan Rose [Fri, 5 Sep 2014 16:33:51 +0000 (16:33 +0000)]
[analyzer] Don't crash if malloc() has an unexpected function prototype.

Patch by Daniel Fahlgren!

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

9 years ago[ARMv8] Add support for 32-bit MIN/MAXNM and directed rounding.
James Molloy [Fri, 5 Sep 2014 13:50:34 +0000 (13:50 +0000)]
[ARMv8] Add support for 32-bit MIN/MAXNM and directed rounding.

This patch adds support for the 32bit numeric max/min and directed round-to-integral NEON intrinsics that were added as part of v8, along with unit tests.

Patch by Graham Hunter!

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

9 years agoMark ms-inline-asm as xfail on ARM
Renato Golin [Fri, 5 Sep 2014 13:29:23 +0000 (13:29 +0000)]
Mark ms-inline-asm as xfail on ARM

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

9 years agoclang-format: [JS] Format embedded function literals more efficently.
Daniel Jasper [Fri, 5 Sep 2014 09:27:38 +0000 (09:27 +0000)]
clang-format: [JS] Format embedded function literals more efficently.

Before:
  return {
    a: a,
    link:
        function() {
          f();  //
        },
    link:
        function() {
          f();  //
        }
  };

After:
  return {
    a: a,
    link: function() {
      f();  //
    },
    link: function() {
      f();  //
    }
  };

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

9 years agoclang-format: [JS] JavaScript does not have the */&/&& madness.
Daniel Jasper [Fri, 5 Sep 2014 08:53:45 +0000 (08:53 +0000)]
clang-format: [JS] JavaScript does not have the */&/&& madness.

Before:
  e&& e.SomeFunction();

After:
  e && e.SomeFunction();

Yeah, this might be useful for C++, too, but it is not such a frequent
pattern there (plus the fix is much harder).

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

9 years agoclang-format: [JS] Better support for empty function literals.
Daniel Jasper [Fri, 5 Sep 2014 08:42:27 +0000 (08:42 +0000)]
clang-format: [JS] Better support for empty function literals.

Before:
  SomeFunction(function(){});

After:
  SomeFunction(function() {});

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

9 years agoclang-format: [JS] Fix indentation in dict literals.
Daniel Jasper [Fri, 5 Sep 2014 08:29:31 +0000 (08:29 +0000)]
clang-format: [JS] Fix indentation in dict literals.

Before:
  return {
    'finish':
        //
        a
        };

After:
  return {
    'finish':
        //
        a
  };

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

9 years agoclang/test/CXX/drs/dr5xx.cpp: Fix up assumption of thiscall. It affects not x64 but...
NAKAMURA Takumi [Fri, 5 Sep 2014 08:18:53 +0000 (08:18 +0000)]
clang/test/CXX/drs/dr5xx.cpp: Fix up assumption of thiscall. It affects not x64 but x86.

Note, i686-cygwin doesn't use thiscall.

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

9 years agoRemove suppression of dr547 test and instead test that deduction succeeds if we
Richard Smith [Fri, 5 Sep 2014 00:17:00 +0000 (00:17 +0000)]
Remove suppression of dr547 test and instead test that deduction succeeds if we
use __thiscall. (This doesn't actually work for MSVC; they don't allow the
__thiscall qualifier here, but it's sufficient to demonstrate that we do
implement the intent of the DR.)

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

9 years agounique_ptrify AnalysisConsumer.cpp::CreateUbiViz
David Blaikie [Fri, 5 Sep 2014 00:14:57 +0000 (00:14 +0000)]
unique_ptrify AnalysisConsumer.cpp::CreateUbiViz

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

9 years agoRemove a use of raw pointer ownership (then non-ownership) in TrimmedGraph::popNextRe...
David Blaikie [Fri, 5 Sep 2014 00:11:25 +0000 (00:11 +0000)]
Remove a use of raw pointer ownership (then non-ownership) in TrimmedGraph::popNextReportGraph

(just cleaning up unique_ptr stuff by finding interesting 'reset' calls
at the moment)

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

9 years agoFix comment indentation.
David Blaikie [Fri, 5 Sep 2014 00:07:20 +0000 (00:07 +0000)]
Fix comment indentation.

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

9 years agounique_ptrify ExplodedGraph::trim
David Blaikie [Fri, 5 Sep 2014 00:04:19 +0000 (00:04 +0000)]
unique_ptrify ExplodedGraph::trim

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

9 years agounique_ptrify the result of ConstraintManagerCreator and StoreManagerCreator
David Blaikie [Thu, 4 Sep 2014 23:54:37 +0000 (23:54 +0000)]
unique_ptrify the result of ConstraintManagerCreator and StoreManagerCreator

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

9 years agounique_ptrify BugReporter::visitors
David Blaikie [Thu, 4 Sep 2014 23:54:33 +0000 (23:54 +0000)]
unique_ptrify BugReporter::visitors

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

9 years agoclang/test/CXX/drs/dr5xx.cpp: Suppress dr547 also for MinGW
Hans Wennborg [Thu, 4 Sep 2014 23:48:47 +0000 (23:48 +0000)]
clang/test/CXX/drs/dr5xx.cpp: Suppress dr547 also for MinGW

This is a follow-up to r216841.

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

9 years agoStop double visiting some expressions during self reference checking.
Richard Trieu [Thu, 4 Sep 2014 23:19:34 +0000 (23:19 +0000)]
Stop double visiting some expressions during self reference checking.

Originally, self reference checking made a double pass over some expressions
to handle reference type checking.  Now, allow HandleValue to also check
reference types, and fallback to Visit for unhandled expressions.

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

9 years agoDon't allow inline asm statements to reference parameters in naked functions
Hans Wennborg [Thu, 4 Sep 2014 22:16:48 +0000 (22:16 +0000)]
Don't allow inline asm statements to reference parameters in naked functions

Differential Revision: http://reviews.llvm.org/D5183

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

9 years agoDon't allow non-ASM statements in naked functions
Hans Wennborg [Thu, 4 Sep 2014 22:16:40 +0000 (22:16 +0000)]
Don't allow non-ASM statements in naked functions

Naked functions don't have prologues or epilogues, so doing
codegen for anything other than inline assembly would be completely
hit or miss.

Differential Revision: http://reviews.llvm.org/D5183

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

9 years agoDon't emit prologues or epilogues for naked functions (PR18791, PR20028)
Hans Wennborg [Thu, 4 Sep 2014 22:16:33 +0000 (22:16 +0000)]
Don't emit prologues or epilogues for naked functions (PR18791, PR20028)

For naked functions with parameters, Clang would still emit stores in the prologue
that would clobber the stack, because LLVM doesn't set up a stack frame. (This
shows up in -O0 compiles, because the stores are optimized away otherwise.)

For example:

  __attribute__((naked)) int f(int x) {
    asm("movl $42, %eax");
    asm("retl");
  }

Would result in:

  _Z1fi:
  movl    12(%esp), %eax
  movl    %eax, (%esp)    <--- Oops.
  movl    $42, %eax
  retl

Differential Revision: http://reviews.llvm.org/D5183

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

9 years agoPR20844: If we fail to list-initialize a reference, map to the referenced type
Richard Smith [Thu, 4 Sep 2014 22:13:39 +0000 (22:13 +0000)]
PR20844: If we fail to list-initialize a reference, map to the referenced type
before retrying the initialization to produce diagnostics. Otherwise, we may
fail to produce any diagnostics, and silently produce invalid AST in a -Asserts
build. Also add a note to this codepath to make it more clear why we were
trying to create a temporary.

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

9 years agoMS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)
Hans Wennborg [Thu, 4 Sep 2014 21:39:52 +0000 (21:39 +0000)]
MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)

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

9 years agoMS format strings: support the 'w' length modifier (PR20808)
Hans Wennborg [Thu, 4 Sep 2014 21:39:46 +0000 (21:39 +0000)]
MS format strings: support the 'w' length modifier (PR20808)

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

9 years agoAdd triple to ms-inline-asm-return.cpp test
Reid Kleckner [Thu, 4 Sep 2014 20:16:12 +0000 (20:16 +0000)]
Add triple to ms-inline-asm-return.cpp test

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

9 years agoMS inline asm: Allow __asm blocks to set a return value
Reid Kleckner [Thu, 4 Sep 2014 20:04:38 +0000 (20:04 +0000)]
MS inline asm: Allow __asm blocks to set a return value

If control falls off the end of a function after an __asm block, MSVC
assumes that the inline assembly filled the EAX and possibly EDX
registers with an appropriate return value. This functionality is used
in inline functions returning 64-bit integers in system headers, so we
need some amount of compatibility.

This is implemented in Clang by adding extra output constraints to every
inline asm block, and storing the resulting output registers into the
return value slot. If we see an asm block somewhere in the function
body, we emit a normal epilogue instead of marking the end of the
function with a return type unreachable.

Normal returns in functions not using this functionality will overwrite
the return value slot, and in most cases LLVM should be able to
eliminate the dead stores.

Fixes PR17201.

Reviewed By: majnemer

Differential Revision: http://reviews.llvm.org/D5177

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

9 years agoclang-format: [JS] Support alternative operator names as identifiers.
Daniel Jasper [Thu, 4 Sep 2014 18:23:42 +0000 (18:23 +0000)]
clang-format: [JS] Support alternative operator names as identifiers.

Before:
  not. and . or . not_eq = 1;

After:
  not.and.or.not_eq = 1;

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

9 years agoWin64: Add the uwtable attribute by default on Win64
Reid Kleckner [Thu, 4 Sep 2014 18:13:12 +0000 (18:13 +0000)]
Win64: Add the uwtable attribute by default on Win64

Now that LLVM emits correct .pdata and .xdata for inline functions, we
can reenable this.

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

9 years agoMS inline asm: Add a test for xgetbv clobbers
Reid Kleckner [Thu, 4 Sep 2014 16:58:47 +0000 (16:58 +0000)]
MS inline asm: Add a test for xgetbv clobbers

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

9 years agounique_ptrify JobList::Jobs
David Blaikie [Thu, 4 Sep 2014 16:04:28 +0000 (16:04 +0000)]
unique_ptrify JobList::Jobs

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

9 years agoFix the clang -Werror build after r217152 by flagging a polymorphically used but...
David Blaikie [Thu, 4 Sep 2014 16:01:24 +0000 (16:01 +0000)]
Fix the clang -Werror build after r217152 by flagging a polymorphically used but statically owned hierarchy with a protected base dtor and final classes to satisfy -Wnon-virtual-dtor

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

9 years agoFix double full-stop that was accidentally added in r217160.
Daniel Sanders [Thu, 4 Sep 2014 15:07:43 +0000 (15:07 +0000)]
Fix double full-stop that was accidentally added in r217160.

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

9 years ago[mips] Mark aggregates returned in registers with the 'inreg' attribute.
Daniel Sanders [Thu, 4 Sep 2014 15:05:39 +0000 (15:05 +0000)]
[mips] Mark aggregates returned in registers with the 'inreg' attribute.

Summary:
This allows us to easily find them in the backend after the aggregates have
been lowered to other types. This is important on big-endian targets using
the N32/N64 ABI's since these ABI's must shift small structures into the
upper bits of the register.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5005

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

9 years agoclang-format: [JS] Supprot "catch" as function name.
Daniel Jasper [Thu, 4 Sep 2014 15:03:34 +0000 (15:03 +0000)]
clang-format: [JS] Supprot "catch" as function name.

Before:
  someObject.catch ();

After:
  someObject.catch();

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

9 years agoclang-format: [JS] Support comments in dict literals.
Daniel Jasper [Thu, 4 Sep 2014 14:58:30 +0000 (14:58 +0000)]
clang-format: [JS] Support comments in dict literals.

Before:
  var stuff = {
    // comment for update
    update : false,
             // comment for update
    modules : false,
              // comment for update
    tasks : false
  };

After:
  var stuff = {
    // comment for update
    update : false,
    // comment for update
    modules : false,
    // comment for update
    tasks : false
  };

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

9 years agoRefactor VariantMatcher::MatcherOps to reduce the amount of generated code.
Samuel Benzaquen [Thu, 4 Sep 2014 14:13:58 +0000 (14:13 +0000)]
Refactor VariantMatcher::MatcherOps to reduce the amount of generated code.

Summary:
Refactor VariantMatcher::MatcherOps to reduce the amount of generated code.
 - Make some code type agnostic and move it to the cpp file.
 - Return a DynTypedMatcher instead of storing the object in MatcherOps.

This change reduces the number of symbols generated in Registry.cpp by
~19%, the object byte size by ~17% and the compilation time (in non-release mode) by ~20%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5124

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

9 years ago[mips] Zero-sized structs cannot be ignored in MipsABIInfo::classifyReturnType()...
Daniel Sanders [Thu, 4 Sep 2014 13:28:14 +0000 (13:28 +0000)]
[mips] Zero-sized structs cannot be ignored in MipsABIInfo::classifyReturnType() for O32

Summary:
They are returned indirectly which causes the other arguments to move to
the next argument slot.

With this, utils/ABITest does not discover any failing cases in the first
500 attempts on big/little endian for O32. Previously some of these failed.
Also tested N32/N64 little endian (big endian has other known issues) with
no issues.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: atanasyan, cfe-commits

Differential Revision: http://reviews.llvm.org/D4811

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

9 years agoARM: Default to apcs-gnu ABI for NetBSD
Oliver Stannard [Thu, 4 Sep 2014 10:38:53 +0000 (10:38 +0000)]
ARM: Default to apcs-gnu ABI for NetBSD

r216662 changed the default ABI for 32-bit ARM targets to be "aapcs"
when no environment is given in the triple, however NetBSD requires it
to be "apcs-gnu".

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

9 years agoAdd matcher for linkage specification
Manuel Klimek [Thu, 4 Sep 2014 08:51:06 +0000 (08:51 +0000)]
Add matcher for linkage specification

Patch by Jacques Pienaar.

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

9 years agoAdjust test to handle fallout from r217102.
David Majnemer [Wed, 3 Sep 2014 23:20:58 +0000 (23:20 +0000)]
Adjust test to handle fallout from r217102.

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

9 years ago[modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixes
Richard Smith [Wed, 3 Sep 2014 23:11:22 +0000 (23:11 +0000)]
[modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixes
merging of namespace aliases across modules and improves source fidelity.
Incidentally also fixes PR20816.

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

9 years agoAdd ubsan/not_ubsan features to Clang lit tests and use
Alexey Samsonov [Wed, 3 Sep 2014 19:46:32 +0000 (19:46 +0000)]
Add ubsan/not_ubsan features to Clang lit tests and use
them to exclude tests with large stack usage from UBSan bootstrap.

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

9 years agoFix member function call on null pointer in Sema::FindInstantiatedDecl.
Alexey Samsonov [Wed, 3 Sep 2014 18:45:45 +0000 (18:45 +0000)]
Fix member function call on null pointer in Sema::FindInstantiatedDecl.

This bug was reported by UBSan.

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

9 years agoEnhance the 'Vectors and Extended Vectors' section.
Anton Yartsev [Wed, 3 Sep 2014 17:59:21 +0000 (17:59 +0000)]
Enhance the 'Vectors and Extended Vectors' section.

Added cast operations to the table of vector operations. Supported status 'no' means that there are no tests in the Clang test suite for the given cast.

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

9 years agoUpdate for LLVM api change.
Rafael Espindola [Wed, 3 Sep 2014 17:31:52 +0000 (17:31 +0000)]
Update for LLVM api change.

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

9 years agoFix indentation. No behavior change.
Nico Weber [Wed, 3 Sep 2014 15:28:00 +0000 (15:28 +0000)]
Fix indentation. No behavior change.

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

9 years agoSplit off CUDA-specific Sema parts to a new file
Eli Bendersky [Wed, 3 Sep 2014 15:27:03 +0000 (15:27 +0000)]
Split off CUDA-specific Sema parts to a new file

In line with SemaOpenMP.cpp, etc. CUDA-specific semantic analysis code goes into
a separate file. This is in anticipation of adding extra functionality here in
the near future.

No change in functionality.

Review: http://reviews.llvm.org/D5160

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

9 years agoCGBuiltin: Use @llvm.fabs rather than fabs libcall when emitting builtins
Tom Stellard [Wed, 3 Sep 2014 15:24:29 +0000 (15:24 +0000)]
CGBuiltin: Use @llvm.fabs rather than fabs libcall when emitting builtins

Using the intrinsic allows the SelectionDAGBuilder to turn this call
into the FABS Node and also the intrinsic is something the vectorizer knows
how to vectorize.

This patch also sets the readnone attribute on this call, which should
enable additional optmizations.

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

10 years agoFix configure and make build of clang-interpreter.
Iain Sandoe [Wed, 3 Sep 2014 13:13:50 +0000 (13:13 +0000)]
Fix configure and make build of clang-interpreter.

Replaced 'jit' link component with 'mcjit'.
Updated the required libraries.

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

10 years agoASTMatchers: Add a matcher to detect whether a decl or stmt is inside a template...
Benjamin Kramer [Wed, 3 Sep 2014 12:08:14 +0000 (12:08 +0000)]
ASTMatchers: Add a matcher to detect whether a decl or stmt is inside a template instantiation.

This is hoisted from clang-tidy where it's used everywhere. The implementation
is not particularly efficient right now, but there is no easy fix for that.

Differential Revision: http://reviews.llvm.org/D5085

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

10 years agoParse: Replace polymorphic functor objects with lambdas and llvm::function_ref.
Benjamin Kramer [Wed, 3 Sep 2014 11:06:10 +0000 (11:06 +0000)]
Parse: Replace polymorphic functor objects with lambdas and llvm::function_ref.

No change in functionality.

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

10 years agoclang-format: Add an option 'SpaceAfterCStyleCast'.
Daniel Jasper [Wed, 3 Sep 2014 07:37:29 +0000 (07:37 +0000)]
clang-format: Add an option 'SpaceAfterCStyleCast'.

This permits to add a space after closing parenthesis of a C-style cast.
Defaults to false to preserve old behavior.

Fixes llvm.org/PR19982.

Before:
  (int)i;

After:
  (int) i;

Patch by Marek Kurdej.

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

10 years agoAllow a scoped lockable object to acquire/release multiple locks.
Ed Schouten [Wed, 3 Sep 2014 06:00:11 +0000 (06:00 +0000)]
Allow a scoped lockable object to acquire/release multiple locks.

Scoped lockable objects (mutex guards) are implemented as if it is a
lock itself that is acquired upon construction and unlocked upon
destruction. As it if course needs to be used to actually lock down
something else (a mutex), it keeps track of this knowledge through its
underlying mutex field in its FactEntry.

The problem with this approach is that this only allows us to lock down
a single mutex, so extend the code to use a vector of underlying
mutexes. This, however, makes the code a bit more complex than
necessary, so subclass FactEntry into LockableFactEntry and
ScopedLockableFactEntry and move all the logic that differs between
regular locks and scoped lockables into member functions.

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

10 years ago[modules] Use DeclContext::equals rather than == on DeclContext* when
Richard Smith [Wed, 3 Sep 2014 02:33:22 +0000 (02:33 +0000)]
[modules] Use DeclContext::equals rather than == on DeclContext* when
determining whether a declaration is out of line, instead of assuming
that the semantic and lexical DeclContext will be the same declaration
whenever they're the same entity.

This fixes behavior of declarations within merged classes and enums.

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

10 years agoReinstate "Update for llvm API change.""
Eric Christopher [Tue, 2 Sep 2014 22:35:49 +0000 (22:35 +0000)]
Reinstate "Update for llvm API change.""

This reinstates r215113.

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

10 years agoFix up formatting.
Eli Bendersky [Tue, 2 Sep 2014 22:00:06 +0000 (22:00 +0000)]
Fix up formatting.

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

10 years agoAvoid test failure on platforms where size_t is long long (and thus can't be
Richard Smith [Tue, 2 Sep 2014 21:39:21 +0000 (21:39 +0000)]
Avoid test failure on platforms where size_t is long long (and thus can't be
directly written in strictly-conforming source code).

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