]> granicus.if.org Git - clang/log
clang
9 years agoWhen the diagnostic text is simply "%0", sanitize the string for any
Richard Trieu [Thu, 8 Jan 2015 01:27:03 +0000 (01:27 +0000)]
When the diagnostic text is simply "%0", sanitize the string for any
unprintable characters.  Fixes PR22048.

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

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Wed, 7 Jan 2015 23:50:05 +0000 (23:50 +0000)]
Wrap to 80 columns. No behavior change.

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

9 years agoAdd help text for mmacosx-version-min=, mios-version-min=.
Nico Weber [Wed, 7 Jan 2015 22:40:55 +0000 (22:40 +0000)]
Add help text for mmacosx-version-min=, mios-version-min=.

I keep forgetting the exact spelling of -macosx-version-min=, and now I can
run `bin/clang --help | grep version -A 2` to remind myself.  While here,
also document -mios-version-min=.  Don't document -mios-simulator-version-min=
as it's just an alias for -mios-version-min= these days.

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

9 years agoHandle OpaqueValueExprs more intelligently in the TransformTypos tree
Kaelyn Takata [Wed, 7 Jan 2015 21:16:39 +0000 (21:16 +0000)]
Handle OpaqueValueExprs more intelligently in the TransformTypos tree
transform.

Also diagnose typos in the initializer of an invalid C++ declaration.
Both issues were hit using the same line of test code, depending on
whether the code was treated as C or C++.

Fixes PR22092.

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

9 years agoSlightly simplify the test from r225361.
Nico Weber [Wed, 7 Jan 2015 18:47:51 +0000 (18:47 +0000)]
Slightly simplify the test from r225361.

Shorter and doesn't need -O2 -- but still suboptimal as it's still doing
-emit-obj.  dblaikie says he'll improve this when he'll reland his change
with a fix.

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

9 years agoclang-format: Let Chromium use the Google default for AlignTrailingComments.
Nico Weber [Wed, 7 Jan 2015 18:41:10 +0000 (18:41 +0000)]
clang-format: Let Chromium use the Google default for AlignTrailingComments.

r225141 changed the defaults of AllowShortIfStatementsOnASingleLine and
AlignTrailingComments for Google style and added explicit overrides for
Chromium style to undo these changes.  For AllowShortIfStatementsOnASingleLine
that's good as the Android style guide (which Chromium uses for Java) explicitly
permits single-line ifs. But it's silent on trailing comments, to it makes
sense for Chromium style to just follow Google style.

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

9 years agoRevert r225085, it caused PR22096.
Nico Weber [Wed, 7 Jan 2015 18:23:08 +0000 (18:23 +0000)]
Revert r225085, it caused PR22096.

PR22096 has several test cases that assert that look fairly different. I'm
adding one of those as an automated test, but when relanding the other cases
should probably be checked as well.

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

9 years agoDebug info: pass in the correct size for a pointer to a member function.
Adrian Prantl [Wed, 7 Jan 2015 17:49:30 +0000 (17:49 +0000)]
Debug info: pass in the correct size for a pointer to a member function.
This corrects a bug I introduced in r224781.

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

9 years agoclang-format: Understand single-line comments at the end of blocks.
Daniel Jasper [Wed, 7 Jan 2015 14:00:11 +0000 (14:00 +0000)]
clang-format: Understand single-line comments at the end of blocks.

This prevents clang-format from moving/aligning the comment in the
snippet:
  void f() {
    int i; // some comment
    // some unrelated comment
  }

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

9 years agoclang-format: Fix unary operator detection.
Daniel Jasper [Wed, 7 Jan 2015 12:19:53 +0000 (12:19 +0000)]
clang-format: Fix unary operator detection.

Before:
  ** outparam = 1;

After:
  **outparam = 1;

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

9 years agoFix comment typo.
Nico Weber [Wed, 7 Jan 2015 05:25:05 +0000 (05:25 +0000)]
Fix comment typo.

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

9 years agoFix grammar-o in comment.
Nico Weber [Tue, 6 Jan 2015 23:54:59 +0000 (23:54 +0000)]
Fix grammar-o in comment.

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

9 years agoSuppress clang warnings in a codegen test.
Rafael Espindola [Tue, 6 Jan 2015 23:53:13 +0000 (23:53 +0000)]
Suppress clang warnings in a codegen test.

This makes the output of FileCheck way easier to read since this test hits
many warnings.

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

9 years agoAdd __builtin_amdgpu_class
Matt Arsenault [Tue, 6 Jan 2015 23:14:57 +0000 (23:14 +0000)]
Add __builtin_amdgpu_class

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

9 years ago[PowerPC] Add support for -mcmpb
Hal Finkel [Tue, 6 Jan 2015 23:06:41 +0000 (23:06 +0000)]
[PowerPC] Add support for -mcmpb

In r225106, support for the CMPB instruction was added to the PowerPC backend.
This adds the associated GCC-compatible feature flag.

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

9 years agoUpdate for .ll syntax change.
Rafael Espindola [Tue, 6 Jan 2015 22:55:40 +0000 (22:55 +0000)]
Update for .ll syntax change.

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

9 years agoR600: Handle amdgcn triple
Tom Stellard [Tue, 6 Jan 2015 20:34:47 +0000 (20:34 +0000)]
R600: Handle amdgcn triple

For now there is no difference between amdgcn and r600.

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

9 years agoBasic: fix compilation with MSVC
Saleem Abdulrasool [Tue, 6 Jan 2015 05:55:56 +0000 (05:55 +0000)]
Basic: fix compilation with MSVC

MSVC doesn't like the instantiation of the structure in the initializer list.
Initialize it in the constructor body to repair the build.

TargetInfo.h(545) : error C2143: syntax error : missing ')' before '{'
TargetInfo.h(545) : error C2143: syntax error : missing ';' before '}'
TargetInfo.h(545) : error C2059: syntax error : ')'
TargetInfo.h(545) : error C2059: syntax error : ','
TargetInfo.h(547) : error C2143: syntax error : missing ';' before '{'
TargetInfo.h(547) : error C2447: '{' : missing function header (old-style formal list?)

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

9 years agoSema: analyze I,J,K,M,N,O constraints
Saleem Abdulrasool [Tue, 6 Jan 2015 04:26:34 +0000 (04:26 +0000)]
Sema: analyze I,J,K,M,N,O constraints

Add additional constraint checking for target specific behaviour for inline
assembly constraints.  We would previously silently let all arguments through
for these constraints.  In cases where the constraints were violated, we could
end up failing to select instructions and triggering assertions or worse,
silently ignoring instructions.

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

9 years agoSet the default ISA for OpenBSD/mips64 to MIPS III.
Brad Smith [Tue, 6 Jan 2015 02:53:17 +0000 (02:53 +0000)]
Set the default ISA for OpenBSD/mips64 to MIPS III.

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

9 years agoAllow -fsanitize-coverage=N with ubsan, clang part
Kostya Serebryany [Tue, 6 Jan 2015 01:02:48 +0000 (01:02 +0000)]
Allow -fsanitize-coverage=N with ubsan, clang part

Summary:
Allow -fsanitize-coverage=N with ubsan, clang part.
This simply allows the flag combination.
The LLVM will work out of the box, the compile-rt part
will follow as a separate patch.

Test Plan: check-clang

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

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

9 years agoRevert "Use the integrated assembler by default on 32-bit PowerPC and SPARC"
Duncan P. N. Exon Smith [Mon, 5 Jan 2015 23:31:42 +0000 (23:31 +0000)]
Revert "Use the integrated assembler by default on 32-bit PowerPC and SPARC"

This reverts commit r225212.  It's failing on multiple buildbots [1][2].

[1]: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/22032
[2]: http://lab.llvm.org:8080/green/view/Clang/job/clang-stage1-cmake-RA-incremental_check/2357/

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

9 years agoUse the integrated assembler by default on 32-bit PowerPC and SPARC
Brad Smith [Mon, 5 Jan 2015 21:44:15 +0000 (21:44 +0000)]
Use the integrated assembler by default on 32-bit PowerPC and SPARC

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

9 years agoFix lit for builds under /opt
Francisco Lopes da Silva [Mon, 5 Jan 2015 19:59:24 +0000 (19:59 +0000)]
Fix lit for builds under /opt

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

9 years agoMake this test a bit stricter.
Rafael Espindola [Mon, 5 Jan 2015 18:48:18 +0000 (18:48 +0000)]
Make this test a bit stricter.

The first function is named __cxx_global_var_init, which is a substring of
the following functions @__cxx_global_var_init(1,2,3,etc).

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

9 years agoDisable warnings in this test.
Rafael Espindola [Mon, 5 Jan 2015 18:19:35 +0000 (18:19 +0000)]
Disable warnings in this test.

This makes it a lot easier to read the output from FileCheck when it fails.

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

9 years agoFix clash of gcc toolchains in driver regression tests.
Samuel Antao [Mon, 5 Jan 2015 17:07:42 +0000 (17:07 +0000)]
Fix clash of gcc toolchains in driver regression tests.

For some regression tests the path to the right toolchain is specified using the -sysroot switch. However, if clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by sysroot. This causes several regression tests to fail as they will be using an unexpected path. This patch fixes this issue by adding --gcc-toolchain='' to all tests that rely on that. The empty string causes the driver to pick the path from sysroot instead.

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

9 years agoFix dangling pointer in isDerivedFrom.
Samuel Benzaquen [Mon, 5 Jan 2015 15:26:42 +0000 (15:26 +0000)]
Fix dangling pointer in isDerivedFrom.

Summary:
Replace usage of StringRef with std::string in AST_MATCHER* generated
matchers to make sure they keep their own copy of the string.
The value could be a temporary and it causes the pointer to be dangling
by the time the matcher is executed.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

9 years agoclang/CMakeLists.txt: Introduce LLVM_SHLIB_OUTPUT_INTDIR also here, or plugins tests...
NAKAMURA Takumi [Mon, 5 Jan 2015 14:06:14 +0000 (14:06 +0000)]
clang/CMakeLists.txt: Introduce LLVM_SHLIB_OUTPUT_INTDIR also here, or plugins tests might fail.

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

9 years agoFix formatting. NFC.
Rafael Espindola [Mon, 5 Jan 2015 13:44:59 +0000 (13:44 +0000)]
Fix formatting. NFC.

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

9 years agoclang-format: [Java] Fix incorrect detection of cast.
Daniel Jasper [Mon, 5 Jan 2015 10:33:39 +0000 (10:33 +0000)]
clang-format: [Java] Fix incorrect detection of cast.

After:
  return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa(
                                      aaaaaaaaaaaaaaaaaaaaa)
                                : aaaaaaaaaaaaaaaaaaaaaaa;

After:
  return (a instanceof List<?>)
      ? aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
      : aaaaaaaaaaaaaaaaaaaaaaa;

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

9 years agoclang-format: [Java] Fix incorrect recognition of annonymous classes.
Daniel Jasper [Sun, 4 Jan 2015 20:40:51 +0000 (20:40 +0000)]
clang-format: [Java] Fix incorrect recognition of annonymous classes.

Before:
  someFunction(new Runnable() { public void run() { System.out.println(42);
  }
  });

After:
  someFunction(new Runnable() {
    public void run() {
      System.out.println(42);
    }
  });

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

9 years agoclang-format: [Java] Change a few flags for Google's Java style.
Daniel Jasper [Sun, 4 Jan 2015 20:40:45 +0000 (20:40 +0000)]
clang-format: [Java] Change a few flags for Google's Java style.

No tests added as all of these are already tested separately.

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

9 years agoRemove an assert that's not true on invalid code.
Nico Weber [Sun, 4 Jan 2015 20:32:12 +0000 (20:32 +0000)]
Remove an assert that's not true on invalid code.

r185773 added an assert that checked that a CXXUnresolvedConstructExpr either
has a valid rparen, or exactly one argument.  This doesn't have to be true for
invalid inputs.  Convert the assert to an if, and add a test for this case.

Found by SLi's afl bot.

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

9 years agoFix default image name to 'a.exe' on Windows, instead 'a.out'.
Yaron Keren [Sun, 4 Jan 2015 13:48:30 +0000 (13:48 +0000)]
Fix default image name to 'a.exe' on Windows, instead 'a.out'.
This applies to mingw as clang-cl already has its own logic for the filename.

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

9 years agoclang-format: Re-enable comment re-indentation for Java/JS.
Daniel Jasper [Sun, 4 Jan 2015 09:11:17 +0000 (09:11 +0000)]
clang-format: Re-enable comment re-indentation for Java/JS.

This was broken by r224120.

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

9 years agoFix indentation. No behavior change.
Nico Weber [Sun, 4 Jan 2015 08:07:54 +0000 (08:07 +0000)]
Fix indentation. No behavior change.

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

9 years agoWrap to 80 columns, no behavior change.
Nico Weber [Sun, 4 Jan 2015 07:59:35 +0000 (07:59 +0000)]
Wrap to 80 columns, no behavior change.

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

9 years agoDocument that GetTypeForDeclarator() cannot return a null type.
Nico Weber [Sun, 4 Jan 2015 05:29:21 +0000 (05:29 +0000)]
Document that GetTypeForDeclarator() cannot return a null type.

Also add a few asserts for this.  The existing code assumes this in a bunch
of places already (see e.g. the assert at the top of ParseTypedefDecl(), and
there are many unchecked calls on the result of GetTypeForDeclarator()), and
from looking through the code this should always be true from what I can tell.
This allows removing ASTContext::getNullTypeSourceInfo() too as that's now
unused.

No behavior change intended.

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

9 years agoCrash less enthusiasticially on _Atomic or __restrict__ on invalid types.
Nico Weber [Sun, 4 Jan 2015 04:53:10 +0000 (04:53 +0000)]
Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.

Many places in Sema cannot handle isNull() types.  This is fine, because in
most places the type building code recovers by falling back to IntTy.  In
GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects()
loop body.  This function calls BuildQualifiedType() before this fallback is
done though, so it explicitly needs to check for isNull() types.

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

9 years agoWrap to 80 columns, no behavior change.
Nico Weber [Sun, 4 Jan 2015 00:47:22 +0000 (00:47 +0000)]
Wrap to 80 columns, no behavior change.

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

9 years agoAST: Remove overzealous assertion from IsModifiable
David Majnemer [Sun, 4 Jan 2015 00:44:32 +0000 (00:44 +0000)]
AST: Remove overzealous assertion from IsModifiable

It's reasonable to ask if an l-value with class type is modifiable.

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

9 years agoParse: __attribute__((keyword)) shouldn't error
David Majnemer [Sat, 3 Jan 2015 19:41:00 +0000 (19:41 +0000)]
Parse: __attribute__((keyword)) shouldn't error

Weird constructs like __attribute__((inline)) or
__attibute__((typename)) should result in warnings, not errors.

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

9 years agoVolatile reads are side-effecting operations, but in the general case of access throu...
Aaron Ballman [Sat, 3 Jan 2015 17:00:12 +0000 (17:00 +0000)]
Volatile reads are side-effecting operations, but in the general case of access through a volatile-qualified type, we're not certain of the underlying object's side-effects on access.

Treat volatile accesses as "maybe" instead of "definite" side effects for the purposes of warning on evaluations in an unevaluated context. No longer diagnose on idiomatic code like:

int * volatile v;
(void)sizeof(*v);

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

9 years agoRemove -Werror from test.
Rafael Espindola [Sat, 3 Jan 2015 00:28:47 +0000 (00:28 +0000)]
Remove -Werror from test.

It is not needed since we FileCheck for the warning and -Werror itself can end up
unused.

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

9 years agoReally don't warn about -flto/fno-lto :-(
Rafael Espindola [Sat, 3 Jan 2015 00:06:04 +0000 (00:06 +0000)]
Really don't warn about -flto/fno-lto :-(

This should fix the last bots.

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

9 years agoAlso avoid warning on -flto/-fno-lto on linux.
Rafael Espindola [Fri, 2 Jan 2015 23:23:52 +0000 (23:23 +0000)]
Also avoid warning on -flto/-fno-lto on linux.

On OS X a .s file is preprocessed, it is not on linux, which is why the warning was still
showing up on linux but not OS X.

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

9 years agoDon't warn on unused -fno-lto.
Rafael Espindola [Fri, 2 Jan 2015 22:56:15 +0000 (22:56 +0000)]
Don't warn on unused -fno-lto.

It is somewhat common for CFLAGS to be used with .s files. We were
already ignoring -flto. This patch just does the same for -fno-lto.

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

9 years agoDebugInfo: Provide a less subtle way to set the debug location of simple ret instructions
David Blaikie [Fri, 2 Jan 2015 22:07:26 +0000 (22:07 +0000)]
DebugInfo: Provide a less subtle way to set the debug location of simple ret instructions

un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083.

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

9 years agoDriver: honour the clang-cl behaviour on ARM as well
Saleem Abdulrasool [Fri, 2 Jan 2015 21:47:33 +0000 (21:47 +0000)]
Driver: honour the clang-cl behaviour on ARM as well

Unfortunately, MSVC does not indicate to the driver what target is being used.
This means that we cannot correctly select the target architecture for the
clang_rt component.  This breaks down when targeting windows with the clang
driver as opposed to the clang-cl driver.  This should fix the native ARM
buildbot tests.

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

9 years agoDriver: reuse getCompilerRT in place of addSanitizerRTWindows
Saleem Abdulrasool [Fri, 2 Jan 2015 20:00:55 +0000 (20:00 +0000)]
Driver: reuse getCompilerRT in place of addSanitizerRTWindows

The logic for addSanitizerRTWindows was performing the same logical operation as
getCompilerRT, which was previously fully generalised for Linux and Windows.
This avoids having a duplication of the logic for building up the name of a
clang_rt component.  This change does move the current limitation for Windows
into getArchNameForCompilerRTLib, where it is assumed that the architecture for
Windows is always i386.

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

9 years agoTemporarily XFAIL fallout from r225083 while investigating.
David Blaikie [Fri, 2 Jan 2015 19:49:28 +0000 (19:49 +0000)]
Temporarily XFAIL fallout from r225083 while investigating.

Between this behavior and that fixed by r225083/r225000, I'll take the
latter over the former for now, but I'm immediately working on
understanding/addressing this behavior too.

(the fact that the code change in r225083 caused this change in behavior
is a bit troubling anyway - given that it looks & claims to be just a
preformance thing)

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

9 years agoDebugInfo: Remove some now-unnecessary location handling around function arguments.
David Blaikie [Fri, 2 Jan 2015 19:49:10 +0000 (19:49 +0000)]
DebugInfo: Remove some now-unnecessary location handling around function arguments.

r225000 generalized debug info line info handling for expressions such
that this code is no longer necessary.

This removes the last use of CGDebugInfo::getLocation, but not all the
uses of CGDebugInfo::CurLoc, which is still used internally in
CGDebugInfo. I'd like to do away with all of that & might succeed after
a few more patches.

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

9 years agoDebugInfo: Fix cases where location failed to be updated after r225000
David Blaikie [Fri, 2 Jan 2015 19:06:25 +0000 (19:06 +0000)]
DebugInfo: Fix cases where location failed to be updated after r225000

The optimization (that appears to have been here since the earliest
implementation (r50848) & has become more complicated over the years) to
avoid recreating the debugloc if it would be the same was out of date
because ApplyDebugLocation was not re-updating the CurLoc/PrevLoc. This
optimization doesn't look terribly beneficial/necessary, so I'm removing
it - if it turns up in benchmarks, I'm happy to reconsider/reimplement
this with justification, but for now it just seems to add
complexity/problems.

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

9 years agoInstantiation of a CXXMethodDecl may fail when the parameter type cannot be instantia...
Nick Lewycky [Fri, 2 Jan 2015 01:33:12 +0000 (01:33 +0000)]
Instantiation of a CXXMethodDecl may fail when the parameter type cannot be instantiated. Do not crash in this case. Fixes PR22040!

The FIXME in the test is caused by TemplateDeclInstantiator::VisitCXXRecordDecl
returning a nullptr instead of creating an invalid decl. This is a common
pattern across all of TemplateDeclInstantiator, so I'm not comfortable changing
it. The reason it's not invalid in the class template is due to support for an
MSVC extension, see r137573.

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

9 years agoCodeGen: Don't crash when a lambda uses a local constexpr variable
David Majnemer [Thu, 1 Jan 2015 09:49:44 +0000 (09:49 +0000)]
CodeGen: Don't crash when a lambda uses a local constexpr variable

The DeclRefExpr might be for a variable initialized by a constant
expression which hasn't been ODR used.
Emit the initializer for the variable instead of trying to capture the
variable itself.

This fixes PR22071.

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

9 years agoXFAIL test on win32 due to missing __complex support
David Blaikie [Wed, 31 Dec 2014 22:30:31 +0000 (22:30 +0000)]
XFAIL test on win32 due to missing __complex support

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

9 years ago[analyzer] Include a couple more comments on using xcrun to query the SDK.
Ted Kremenek [Wed, 31 Dec 2014 08:19:08 +0000 (08:19 +0000)]
[analyzer] Include a couple more comments on using xcrun to query the SDK.

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

9 years ago[analyzer] Change ccc-analyzer to mimick behavior on OSX Mavericks/Yosemite to automa...
Ted Kremenek [Wed, 31 Dec 2014 07:44:51 +0000 (07:44 +0000)]
[analyzer] Change ccc-analyzer to mimick behavior on OSX Mavericks/Yosemite to automatically infer the SDK location.

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

9 years agoHandle PPC64 return type (signext i32 rather than plain i32) in test case
David Blaikie [Wed, 31 Dec 2014 00:06:08 +0000 (00:06 +0000)]
Handle PPC64 return type (signext i32 rather than plain i32) in test case

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

9 years agoDriver: unify compiler-rt component selection
Saleem Abdulrasool [Tue, 30 Dec 2014 22:52:08 +0000 (22:52 +0000)]
Driver: unify compiler-rt component selection

Unify the component handling for compiler-rt.  The components are regularly
named, built up from:

  ${LIBRARY_PREFIX}clang_rt.${component}-${arch}[-${environment}]${LIBRARY_SUFFIX}

Unify the handling for all the various components, into a single path to link
against the various components in a number of places.  This reduces duplication
of the clang_rt library name construction logic.

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

9 years agoDriver: whitespace
Saleem Abdulrasool [Tue, 30 Dec 2014 22:52:06 +0000 (22:52 +0000)]
Driver: whitespace

Fixup some whitespace/style issues.  NFC.

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

9 years agoRemove a comment that appears a second time 22 lines further down.
Nico Weber [Tue, 30 Dec 2014 20:13:37 +0000 (20:13 +0000)]
Remove a comment that appears a second time 22 lines further down.

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

9 years agoReapply "DebugInfo: Generalize debug info location handling"
David Blaikie [Tue, 30 Dec 2014 19:39:33 +0000 (19:39 +0000)]
Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Recommitted in r224941 and reverted in r224970 after it caused a crash
when building compiler-rt. Looks to be due to this change zeroing out
the debug location when emitting default arguments (which were meant to
inherit their outer expression's location) thus creating call
instructions without locations - these create problems for inlining and
must not be created. That is fixed and tested in this version of the
change.

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

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

9 years agoDriver: use the canonical library prefix on Windows
Saleem Abdulrasool [Tue, 30 Dec 2014 18:55:37 +0000 (18:55 +0000)]
Driver: use the canonical library prefix on Windows

Unlike Unices, Windows does not use a library prefix.  Use the traditional
naming scheme even for Windows itanium environments.  This makes the builtins
behave more like the sanitisers as well.

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

9 years agoAdd non-const version getFileSystemOpts() access function.
Yaron Keren [Tue, 30 Dec 2014 18:46:42 +0000 (18:46 +0000)]
Add non-const version getFileSystemOpts() access function.
All the other get*Opts have both versions.

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

9 years agoAdd a public accessor for GlobalCtors in CodeGenModule
Keno Fischer [Tue, 30 Dec 2014 08:12:39 +0000 (08:12 +0000)]
Add a public accessor for GlobalCtors in CodeGenModule

Summary:
In a JIT context it is useful to be able to access the GlobalCtors
and especially clear them once they have been emitted and called.
This adds a public method to be able to access the list.

Subscribers: yaron.keren, cfe-commits

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

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

9 years agoDriver: unify addClangRT{Linux,Windows}
Saleem Abdulrasool [Tue, 30 Dec 2014 02:10:36 +0000 (02:10 +0000)]
Driver: unify addClangRT{Linux,Windows}

The differences are pretty superficial:
- .lib vs .a extensions
- whether or not to link (potentially) incorrectly against libgcc_s

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

9 years agoDon't crash on an invalid trailing return type on a function before a '...'
Nico Weber [Tue, 30 Dec 2014 02:06:40 +0000 (02:06 +0000)]
Don't crash on an invalid trailing return type on a function before a '...'

clang tries to produce a helpful diagnostic for the traiilng '...', but the
code that r216778 added for this doesn't expect an invalid trailing return type.
Add code to explicitly handle this.

Having explicit code for this but not for other things looks a bit strange, but
trailing return types are special in that they have a separate existence bit in
addition to the type (see r158348).

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

9 years agoRevert "DebugInfo: Generalize debug info location handling"
David Blaikie [Mon, 29 Dec 2014 23:49:00 +0000 (23:49 +0000)]
Revert "DebugInfo: Generalize debug info location handling"

Asserting when building compiler-rt when using a GCC host compiler.
Reverting while I investigate.

This reverts commit r224941.

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

9 years agoFix build breakage
David Majnemer [Mon, 29 Dec 2014 23:24:27 +0000 (23:24 +0000)]
Fix build breakage

That's what I get for last second changes...

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

9 years agoParse: Recover more gracefully from extra :: tokens before a {
David Majnemer [Mon, 29 Dec 2014 23:12:23 +0000 (23:12 +0000)]
Parse: Recover more gracefully from extra :: tokens before a {

Instead of crashing, recover by eating the extra trailing scope
qualifier.  This means we will treat 'struct A:: {' as 'struct A {'.

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

9 years agoPR22051: Missing debug location on calls in dtor thunks in Windows.
David Blaikie [Mon, 29 Dec 2014 22:53:52 +0000 (22:53 +0000)]
PR22051: Missing debug location on calls in dtor thunks in Windows.

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

9 years agoUse std::find_if instead of manual loop.
David Blaikie [Mon, 29 Dec 2014 22:39:45 +0000 (22:39 +0000)]
Use std::find_if instead of manual loop.

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

9 years agoCrash even less on malformed attributes in an incorrect location.
Nico Weber [Mon, 29 Dec 2014 21:56:22 +0000 (21:56 +0000)]
Crash even less on malformed attributes in an incorrect location.

This is a follow-up to r224915.  This adds a bit more line noise to the tests
added in that revision to make sure the parser is ready for a toplevel decl
after each incorrect line.  Use this to move the tests up to where they belong.
This uncovered that the early return was missing a call to
ActOnTagDefinitionError(), so add that. (Also fixes at least one of the crashes
on SLi's bot.)

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

9 years agoFix use-after-destruction introduced in r224924.
Alexey Samsonov [Mon, 29 Dec 2014 21:28:15 +0000 (21:28 +0000)]
Fix use-after-destruction introduced in r224924.

getMainExecutable() returns a std::string, assigning its result
to StringRef immediately creates a dangling pointer. This was
detected by half-broken fast-MSan-bootstrap bot.

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

9 years agoDriver: convert a couple more instances to range based loops
Saleem Abdulrasool [Mon, 29 Dec 2014 21:02:47 +0000 (21:02 +0000)]
Driver: convert a couple more instances to range based loops

More conversion to range based for loops rather than direct iterators with
dereferencing.  NFC.

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

9 years agoParse: Ignore '::' in 'struct :: {'
David Majnemer [Mon, 29 Dec 2014 19:19:18 +0000 (19:19 +0000)]
Parse: Ignore '::' in 'struct :: {'

Let's pretend that we didn't see the '::' instead of go on believing
that we've got some anonymous, but globally qualified, struct.

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

9 years agoDriver: convert a number of loops to range based
Saleem Abdulrasool [Mon, 29 Dec 2014 19:01:36 +0000 (19:01 +0000)]
Driver: convert a number of loops to range based

Iterate over the arguments via range based for loops rather than iterators and
explicitly dereferencing them.  NFC.

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

9 years agoAdd an assertion to verify a container is non-empty before calling 'back()'
David Blaikie [Mon, 29 Dec 2014 18:37:03 +0000 (18:37 +0000)]
Add an assertion to verify a container is non-empty before calling 'back()'

This would've helped stabilize/deflake some failures that were seen
after some recent changes.

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

9 years agoReapply "DebugInfo: Generalize debug info location handling"
David Blaikie [Mon, 29 Dec 2014 18:18:45 +0000 (18:18 +0000)]
Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

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

9 years agoEffectively revert r151058 which caused Clang's unwind.h to defer to
Chandler Carruth [Mon, 29 Dec 2014 13:29:38 +0000 (13:29 +0000)]
Effectively revert r151058 which caused Clang's unwind.h to defer to
libunwind in all cases when installed.

At the time, Clang's unwind.h didn't provide huge chunks of the
LSB-specified unwind interface, and was generally too aenemic to use for
real software. However, it has since then become a strict superset of
the APIs provided by libunwind on Linux. Notably, you cannot compile
llgo's libgo library against libunwind, but you can against Clang's
unwind.h. So let's just use our header. =] I've checked pretty
thoroughly for any incompatibilities, and I am not aware of any.

An open question is whether or not we should continue to munge
GNU_SOURCE here. I didn't touch that as it potentially has compatibility
implications on systems I cannot easily test -- Darwin. If a Darwin
maintainer can verify that this is in fact unnecessary and remove it,
cool. Until then, leaving it in makes this change a no-op there, and
only really relevant on Linux systems where it is pretty clearly the
right way to go.

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

9 years agoAdd a missing declaration to our unwind.h implementation. This is
Chandler Carruth [Mon, 29 Dec 2014 13:29:36 +0000 (13:29 +0000)]
Add a missing declaration to our unwind.h implementation. This is
necessary to be fully compatible with existing software that calls into
the linux unwind code. You can find documentation of this API and why it
exists in the discussion abot NPTL here:
https://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html

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

9 years ago[multilib] Teach Clang's code about multilib by threading
Chandler Carruth [Mon, 29 Dec 2014 12:09:08 +0000 (12:09 +0000)]
[multilib] Teach Clang's code about multilib by threading
a CLANG_LIBDIR_SUFFIX down from the build system and using that as part
of the default resource dir computation.

Without this, essentially nothing that uses the clang driver works when
building clang with a libdir suffix. This is probably the single biggest
missing piece of support for multilib as without this people could hack
clang to end up installed in the correct location, but it would then
fail to find its own basic resources. I know of at least one distro that
has some variation on this patch to hack around this; hopefully they'll
be able to use the libdir suffix functionality directly as the rest of
these bits land.

This required fixing a copy of the code to compute Clang's resource
directory that is buried inside of the frontend (!!!). It had bitrotted
significantly relative to the driver code. I've made it essentially
a clone of the driver code in order to keep tests (which use cc1
heavily) passing. This copy should probably just be removed and the
frontend taught to always rely on an explicit resource directory from
the driver, but that is a much more invasive change for another day.

I've also updated one test which actually encoded the resource directory
in its checked output to tolerate multilib suffixes.

Note that this relies on a prior LLVM commit to add a stub to the
autoconf build system for this variable.

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

9 years ago[cmake] Teach the Clang CMake build to use LLVM_LIBDIR_SUFFIX for its
Chandler Carruth [Mon, 29 Dec 2014 12:09:03 +0000 (12:09 +0000)]
[cmake] Teach the Clang CMake build to use LLVM_LIBDIR_SUFFIX for its
'lib' directories in the build. This variable is available now both as
part of the normal LLVM build an as part of a standalone build as I've
added it to the LLVMConfig.cmake output.

With this change we should at least put libraries into the multilib
directory correctly. It is the first step in getting Clang to be
reasonably multilib aware.

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

9 years agoSema: Permit array l-values in asm output operands
David Majnemer [Mon, 29 Dec 2014 10:29:53 +0000 (10:29 +0000)]
Sema: Permit array l-values in asm output operands

GCC permits array l-values in asm output operands even though they
aren't modifiable l-values.  We used to permit it but this behavior
regressed in r224916.

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

9 years agoSema: Only permit permit modifiable l-values as asm output params
David Majnemer [Mon, 29 Dec 2014 09:30:33 +0000 (09:30 +0000)]
Sema: Only permit permit modifiable l-values as asm output params

Functions are l-values in C++ but shouldn't be available as output
parameters in inline assembly.  Neither should overloaded function
l-values.

This fixes PR21949.

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

9 years agoDon't crash on malformed attributes in an incorrect location.
Nico Weber [Mon, 29 Dec 2014 06:56:50 +0000 (06:56 +0000)]
Don't crash on malformed attributes in an incorrect location.

r168626 added nicer diagnostics for attributes in the wrong places, such as
after the `final` on a class.  To do this, it added code that did high-level
pattern matching for e.g. 'final' 'alignas' '(' and then skipped until the
closing ')'.  If it saw that, it then went down the regular class parsing
path and then called MaybeParseCXX11Attributes() to parse the attribute after
the 'final' using real attribute parsing code.  On invalid attributes, the
real attribute parsing code could eat more tokens than the pattern matching
code and for example skip past the '{' starting the class, which would then
lead to an assert.  To prevent this, check for a good state after calling
MaybeParseCXX11Attributes() (which morphed into CheckMisplacedCXX11Attribute()
in r175575) and bail out if things look bleak.

Found by SLi's afl bot.

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

9 years ago[x86] Fix an accidental commit of a change from Ii to iC on __builtin_ia32_cmpps512_mask.
Craig Topper [Mon, 29 Dec 2014 06:55:01 +0000 (06:55 +0000)]
[x86] Fix an accidental commit of a change from Ii to iC on __builtin_ia32_cmpps512_mask.

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

9 years ago[x86] Put 'C' after 'i' on all the AVX-512 intrisics that take const ints. 'C' is...
Craig Topper [Mon, 29 Dec 2014 06:41:12 +0000 (06:41 +0000)]
[x86] Put 'C' after 'i' on all the AVX-512 intrisics that take const ints. 'C' is a suffix modifier not a prefix modififier. Also put 'C' on the pointers in all of the gather instrinsics. I think they previously had one due to the misordering. I'm still thinking the 'iC' actually need to be a 'Ii' since they really require an ICE.

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

9 years agoSema: Don't crash when solitary :: token appears before { in struct def
David Majnemer [Mon, 29 Dec 2014 05:17:46 +0000 (05:17 +0000)]
Sema: Don't crash when solitary :: token appears before { in struct def

hasDeclaratorForAnonDecl, getDeclaratorForAnonDecl and
getTypedefNameForAnonDecl are expected to handle the case where
NamedDeclOrQualifier holds the wrong type or nothing at all.

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

9 years agoSema: Forbid inconsistent constraint alternatives
David Majnemer [Mon, 29 Dec 2014 04:09:59 +0000 (04:09 +0000)]
Sema: Forbid inconsistent constraint alternatives

Verify that asm constraints have the same number of alternatives

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

9 years agoSemaCXX: Don't crash when annotation tokens show up before the tag name
David Majnemer [Mon, 29 Dec 2014 02:14:26 +0000 (02:14 +0000)]
SemaCXX: Don't crash when annotation tokens show up before the tag name

Clang has a hack to accept definitions of structs with tag names which
have the same name as intrinsics.  However, this hack didn't guard
against annotation tokens showing up in the token stream.

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

9 years agoCodeGen: Optimize emssion of zeroinitialzied arrays
David Majnemer [Sun, 28 Dec 2014 23:46:59 +0000 (23:46 +0000)]
CodeGen: Optimize emssion of zeroinitialzied arrays

Create an ConstantAggregateZero upfront if we see that it is viable.
This saves us from having to manually push_back each and every
initializer and then looping back over them to determine if they are
'null'.

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

9 years agoDon't crash on surprising tokens in default parameter template lists.
Nico Weber [Sun, 28 Dec 2014 23:24:02 +0000 (23:24 +0000)]
Don't crash on surprising tokens in default parameter template lists.

Fixes this snippet from SLi's afl fuzzer output:

  class {
      i (x = <, enum

This parsed i as a function, x as a paramter, and the stuff after < as a
template list.  This then called TryConsumeDeclarationSpecifier() which
called TryAnnotateCXXScopeToken() without checking the preconditions of
this function.  Check them before calling, like all other callers of
TryAnnotateCXXScopeToken() do.

A more readable reproducer that causes the same crash is

  class {
      void i(int x = MyTemplateClass<int, union int>::foo());
  };

The reduced version used an eof token as surprising token, but kw_int works
just as well to repro and is easier to insert into a test file.

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

9 years agoSema: Variable templates cannot be static bitfield members
David Majnemer [Sun, 28 Dec 2014 22:51:45 +0000 (22:51 +0000)]
Sema: Variable templates cannot be static bitfield members

We correctly forbid variables but not variable templates.  Diagnose this
case instead of crashing.

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

9 years agoParse: Don't crash when 'typename' shows up in an attribute
David Majnemer [Sun, 28 Dec 2014 22:28:32 +0000 (22:28 +0000)]
Parse: Don't crash when 'typename' shows up in an attribute

isDeclarationSpecifier performs error recovers which jostles the token
stream.  Specifically, TryAnnotateTypeOrScopeToken will end up consuming
a typename token which will confuse the attribute parsing machinery as
we no-longer have something identifier-like.

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

9 years agoSema: Permit an atomic type to be initialized by the same atomic type
David Majnemer [Sun, 28 Dec 2014 21:47:31 +0000 (21:47 +0000)]
Sema: Permit an atomic type to be initialized by the same atomic type

We forgot a conversion step when initializing an atomic type with an
rvalue of the same type.

This fixes PR22043.

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

9 years agoSema: Don't crash when an inject class name has a nested redefinition
David Majnemer [Sun, 28 Dec 2014 09:18:54 +0000 (09:18 +0000)]
Sema: Don't crash when an inject class name has a nested redefinition

We expected the type of a TagDecl to be a TagType, not an
InjectedClassNameType.  Introduced a helper method, Type::getAsTagDecl,
to abstract away the difference; redefine Type::getAsCXXRecordDecl to be
in terms of it.

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

9 years agoLex: Don't let annotation tokens get into macro expansion
David Majnemer [Sun, 28 Dec 2014 07:42:49 +0000 (07:42 +0000)]
Lex: Don't let annotation tokens get into macro expansion

We'd let annotation tokens from '#pragma pack' and the like get inside a
function-like macro.  This would lead to terror and mayhem; stop the
madness early.

This fixes PR22037.

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