]> granicus.if.org Git - clang/log
clang
9 years ago[modules] If the same .pcm file is imported via two different paths, don't
Richard Smith [Tue, 9 Dec 2014 00:14:36 +0000 (00:14 +0000)]
[modules] If the same .pcm file is imported via two different paths, don't
complain that the contained modules are defined twice.

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

9 years agoRevert "Driver: Objective-C should respect -fno-exceptions"
David Majnemer [Tue, 9 Dec 2014 00:12:30 +0000 (00:12 +0000)]
Revert "Driver: Objective-C should respect -fno-exceptions"

This reverts commit r223455.  It's been succesfully argued that
-fexceptions (at the driver level) is a misnomer and has little to do
with -fobjc-exceptions.

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

9 years agoAdd a test for MS-ABI this adjustment for virtual calls to member operators.
Nico Weber [Mon, 8 Dec 2014 23:25:55 +0000 (23:25 +0000)]
Add a test for MS-ABI this adjustment for virtual calls to member operators.

They too were fixed by r223185, despite the commit message saying otherwise.
Add a test that makes sure they don't regress.

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

9 years agoHandle possible TypoExprs in member initializers.
Kaelyn Takata [Mon, 8 Dec 2014 22:41:42 +0000 (22:41 +0000)]
Handle possible TypoExprs in member initializers.

Includes a new test case since none of the existing tests were hitting
this code path.

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

9 years agoDebugInfo: Ensure the store for an assignment is attributed to the beginning of the...
David Blaikie [Mon, 8 Dec 2014 21:48:57 +0000 (21:48 +0000)]
DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression

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

9 years agoclang-format: Indent correctly in conditional expressions after return.
Daniel Jasper [Mon, 8 Dec 2014 21:28:31 +0000 (21:28 +0000)]
clang-format: Indent correctly in conditional expressions after return.

This only applies when not aligning after the return itself (which is
commonly done for C++.

Before:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
             bbbbbb)  // This is indented relative to aaaaaaaaaa.
      : b;

After:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
            bbbbbb)
      : b;

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

9 years agoFix isInstantiated and isInTemplateInstantiation to not recreate the matchers on...
Samuel Benzaquen [Mon, 8 Dec 2014 20:17:58 +0000 (20:17 +0000)]
Fix isInstantiated and isInTemplateInstantiation to not recreate the matchers on each call.

Summary:
Store the result matcher after the first call and reuse it later on.
Recreating the matchers just to use them once incurs in a lot of
unnecessary temporary memory allocations.
This change speeds up our clang-tidy benchmarks by ~2%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

9 years agoclang-format: [Java] Always break after annotations of multiline decls.
Daniel Jasper [Mon, 8 Dec 2014 20:08:04 +0000 (20:08 +0000)]
clang-format: [Java] Always break after annotations of multiline decls.

Before:
  @Mock DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  @Mock
  DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

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

9 years agoclang-format: Make clang-format-diff.py format java files.
Daniel Jasper [Mon, 8 Dec 2014 19:39:03 +0000 (19:39 +0000)]
clang-format: Make clang-format-diff.py format java files.

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

9 years agoInstrProf: Use LLVM's -instrprof pass for profiling
Justin Bogner [Mon, 8 Dec 2014 19:04:51 +0000 (19:04 +0000)]
InstrProf: Use LLVM's -instrprof pass for profiling

The logic for lowering profiling counters has been moved to an LLVM
pass. Emit the intrinsics rather than duplicating the whole pass in
clang.

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

9 years agoclang-format: Support commas in lambda return types.
Daniel Jasper [Mon, 8 Dec 2014 13:22:37 +0000 (13:22 +0000)]
clang-format: Support commas in lambda return types.

Before:
  auto next_pair = [](A * a) -> pair<A*, A*>{};

After:
  auto next_pair = [](A* a) -> pair<A*, A*>{};

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

9 years agoclang/test/Index/usrs.cpp: Appease targeting msvc.
NAKAMURA Takumi [Mon, 8 Dec 2014 10:20:33 +0000 (10:20 +0000)]
clang/test/Index/usrs.cpp: Appease targeting msvc.

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

9 years ago[libclang] Use same USR encoding for 'char' regardless of what the target considers...
Argyrios Kyrtzidis [Mon, 8 Dec 2014 09:09:05 +0000 (09:09 +0000)]
[libclang] Use same USR encoding for 'char' regardless of what the target considers the sign to be.

Should fix the clang-hexagon-elf bot.

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

9 years ago[libclang] Encode InjectedClassNameType in the USR.
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:43 +0000 (08:48 +0000)]
[libclang] Encode InjectedClassNameType in the USR.

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

9 years ago[libclang] Encode location info for anonymous embedded tag decls.
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:37 +0000 (08:48 +0000)]
[libclang] Encode location info for anonymous embedded tag decls.

Otherwise the USR will conflict with different embedded tag decls.

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

9 years ago[libclang] Use same USR encoding for 'class' as 'struct'.
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:33 +0000 (08:48 +0000)]
[libclang] Use same USR encoding for 'class' as 'struct'.

'class' and 'struct' can be used interchangebly for forward references.
Use the same encoding otherwise we may get into a weird situation where the USR for the same
declaration is different based on whether the definition of the tag reference is visible or not.

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

9 years ago[libclang] Encode C++11 rvalue reference types in the USR.
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:27 +0000 (08:48 +0000)]
[libclang] Encode C++11 rvalue reference types in the USR.

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

9 years ago[libclang] Encode the C++11 method reference qualifier in the USR.
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:21 +0000 (08:48 +0000)]
[libclang] Encode the C++11 method reference qualifier in the USR.

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

9 years ago[libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overl...
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:17 +0000 (08:48 +0000)]
[libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overload a 'char' in C++, by giving them distinct encodings.

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

9 years ago[libclang] Function templates can be 'overloaded' by return type, so encode the retur...
Argyrios Kyrtzidis [Mon, 8 Dec 2014 08:48:11 +0000 (08:48 +0000)]
[libclang] Function templates can be 'overloaded' by return type, so encode the return type in the USR
and handle DependentNameType in order to be able to distinguish them.

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

9 years agoclang-format: Don't merge lines with comments.
Daniel Jasper [Sun, 7 Dec 2014 16:44:49 +0000 (16:44 +0000)]
clang-format: Don't merge lines with comments.

Before:
  int f() { // comment return 42; }

After:
  int f() { // comment
    return 42;
  }

This fixes llvm.org/PR21769.

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

9 years agoAdd some file content to avoid test failures on content-addressed file systems.
Richard Smith [Sat, 6 Dec 2014 22:12:07 +0000 (22:12 +0000)]
Add some file content to avoid test failures on content-addressed file systems.

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

9 years agoAdd test file missed from r223561.
Richard Smith [Sat, 6 Dec 2014 22:11:06 +0000 (22:11 +0000)]
Add test file missed from r223561.

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

9 years agoRename a couple of preprocessor symbols to be more descriptive. NFC.
Paul Robinson [Sat, 6 Dec 2014 05:06:37 +0000 (05:06 +0000)]
Rename a couple of preprocessor symbols to be more descriptive. NFC.
Review feedback from recent changes to GetSVN.cmake.

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

9 years ago[modules] If we import a module, and we've seen a module map that describes the
Richard Smith [Sat, 6 Dec 2014 03:21:08 +0000 (03:21 +0000)]
[modules] If we import a module, and we've seen a module map that describes the
module, use the path from the module map file in preference to the path from
the .pcm file when resolving relative paths in the .pcm file. This allows
diagnostics (and .d output) to give relative paths if the module was found via
a relative path.

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

9 years agoNo memcpy for copy ctor with -fsanitize-address-field-padding=1
Kostya Serebryany [Sat, 6 Dec 2014 01:23:08 +0000 (01:23 +0000)]
No memcpy for copy ctor with -fsanitize-address-field-padding=1

Summary:
When -fsanitize-address-field-padding=1 is present
don't emit memcpy for copy constructor.
Thanks Nico for the extra test case.

Test Plan: regression tests

Reviewers: thakis, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

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

9 years agoPR21217: Slightly more eagerly load -fmodule-map-file= files and provide
Richard Smith [Sat, 6 Dec 2014 01:13:41 +0000 (01:13 +0000)]
PR21217: Slightly more eagerly load -fmodule-map-file= files and provide
diagnostics if they don't exist. Based on a patch by John Thompson!

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

9 years agoAdditional safety for the root cause of regression in r223443; make the module
Richard Smith [Sat, 6 Dec 2014 00:09:19 +0000 (00:09 +0000)]
Additional safety for the root cause of regression in r223443; make the module
map path more canonical before hashing it. No functionality change.

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

9 years ago[modules] Instead of storing absolute paths in a .pcm file, store the path to
Richard Smith [Fri, 5 Dec 2014 22:42:13 +0000 (22:42 +0000)]
[modules] Instead of storing absolute paths in a .pcm file, store the path to
the root of the module and use paths relative to that directory wherever
possible. This is a step towards allowing explicit modules to be relocated
without being rebuilt, which is important for some kinds of distributed builds,
for good paths in diagnostics, and for appropriate .d output.

This is a recommit of r223443, reverted in r223465; when joining together
imported file paths, we now use the system's separator rather than always
using '/'. This avoids path mismatches between the original module build and
the module user on Windows (at least, in some cases). A more comprehensive
fix will follow.

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

9 years agoASTDumper: print whether a function is constexpr
Hans Wennborg [Fri, 5 Dec 2014 22:38:57 +0000 (22:38 +0000)]
ASTDumper: print whether a function is constexpr

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

9 years agoSpecify the name of the generated header only once. NFC.
Paul Robinson [Fri, 5 Dec 2014 22:32:49 +0000 (22:32 +0000)]
Specify the name of the generated header only once. NFC.
This will also simplify a private patch that we have.

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

9 years agoMake DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.
Richard Smith [Fri, 5 Dec 2014 21:52:58 +0000 (21:52 +0000)]
Make DiagnosticErrorTrap work even if SuppressAllDiagnostics is enabled.
Patch by Brad King!

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

9 years agoWorkaround attribute ordering issue with kernel only attributes
Matt Arsenault [Fri, 5 Dec 2014 18:03:58 +0000 (18:03 +0000)]
Workaround attribute ordering issue with kernel only attributes

Placing the attribute after the kernel keyword would incorrectly
reject the attribute, so use the smae workaround that other
kernel only attributes use.

Also add a FIXME because there are two different phrasings now
for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one.

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

9 years agoUse else if when checking multiple attributes.
Matt Arsenault [Fri, 5 Dec 2014 18:03:55 +0000 (18:03 +0000)]
Use else if when checking multiple attributes.

Only one of these can really match.

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

9 years agoAmending r223468 with this documentation change.
Aaron Ballman [Fri, 5 Dec 2014 17:11:49 +0000 (17:11 +0000)]
Amending r223468 with this documentation change.

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

9 years agoFix Typos in include/clang-c/Index.h
Chad Rosier [Fri, 5 Dec 2014 15:50:44 +0000 (15:50 +0000)]
Fix Typos in include/clang-c/Index.h
Phabricator revision: http://reviews.llvm.org/D6507

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

9 years agoModify __has_attribute so that it only looks for GNU-style attributes. Removes the...
Aaron Ballman [Fri, 5 Dec 2014 15:24:55 +0000 (15:24 +0000)]
Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.

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

9 years agoAdded a new preprocessor macro: __has_declspec_attribute. This can be used as a way...
Aaron Ballman [Fri, 5 Dec 2014 15:05:29 +0000 (15:05 +0000)]
Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to  __has_attribute and __has_cpp_attribute.

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

9 years agoTemporarily reverting r223443 due to bot breakage.
Aaron Ballman [Fri, 5 Dec 2014 14:52:04 +0000 (14:52 +0000)]
Temporarily reverting r223443 due to bot breakage.

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

9 years agoFix a warning with generating the attribute documentation; NFC.
Aaron Ballman [Fri, 5 Dec 2014 14:11:39 +0000 (14:11 +0000)]
Fix a warning with generating the attribute documentation; NFC.

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

9 years agoclang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.
Daniel Jasper [Fri, 5 Dec 2014 10:42:21 +0000 (10:42 +0000)]
clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.

This fixes llvm.org/PR21756.

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

9 years agoDriver: Objective-C should respect -fno-exceptions
David Majnemer [Fri, 5 Dec 2014 08:56:55 +0000 (08:56 +0000)]
Driver: Objective-C should respect -fno-exceptions

Clang attempted to replicate a GCC bug: -fobjc-exceptions forces
-fexceptions to be enabled.  However, this has unintended effects and
other awkard side effects that Clang doesn't "correctly" ape (e.g. it's
impossible to turn off C++ exceptions in ObjC++ mode).

Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an
identical relationship with -f[no]exceptions.

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

9 years agoDriver: Cleanup -fexceptions behavior
David Majnemer [Fri, 5 Dec 2014 08:11:58 +0000 (08:11 +0000)]
Driver: Cleanup -fexceptions behavior

No functionality change is intended, just a cleanup of the logic clang
uses to determine what -fexceptions/-fno-exceptions ends up doing.

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

9 years ago[OPENMP] Test for 'omp barrier' directive
Alexey Bataev [Fri, 5 Dec 2014 04:10:27 +0000 (04:10 +0000)]
[OPENMP] Test for 'omp barrier' directive

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

9 years ago[OPENMP] Codegen for 'omp barrier' directive.
Alexey Bataev [Fri, 5 Dec 2014 04:09:23 +0000 (04:09 +0000)]
[OPENMP] Codegen for 'omp barrier' directive.
Adds generation of call to "i32 kmpc_cancel_barrier(ident_t *, i32)" libcall for explicitly specified barriers (OMP_IDENT_BARRIER_EXPL flag is added to "flags" field of "ident_t" structure).
Also this patch replaces all calls to "kmpc_barrier" function by calls of "__kmpc_cancel_barrier" function which provides additional functionality for OpenMP 4.0.
Also, library specific enum OpenMPLocationFlags moved to private section of CGOpenMPRuntime class to make it more independent from library implementation.
Differential Revision: http://reviews.llvm.org/D6447

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

9 years ago[modules] Instead of storing absolute paths in a .pcm file, store the path to
Richard Smith [Fri, 5 Dec 2014 02:33:27 +0000 (02:33 +0000)]
[modules] Instead of storing absolute paths in a .pcm file, store the path to
the root of the module and use paths relative to that directory wherever
possible. This is a step towards allowing explicit modules to be relocated
without being rebuilt, which is important for some kinds of distributed builds,
for good paths in diagnostics, and for appropriate .d output.

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

9 years agoHave the driver and the target code agree on what the default ABI
Eric Christopher [Fri, 5 Dec 2014 01:06:59 +0000 (01:06 +0000)]
Have the driver and the target code agree on what the default ABI
is for each machine. Fix up darwin tests that were testing for
aapcs on armv7-ios when the actual ABI is apcs.

Should be no user visible change without -cc1.

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

9 years ago[analyzer] Eliminated endless loop.
Anton Yartsev [Fri, 5 Dec 2014 00:59:07 +0000 (00:59 +0000)]
[analyzer] Eliminated endless loop.

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

9 years agoUse isOSBinFormatMachO() instead of comparing the object format
Eric Christopher [Fri, 5 Dec 2014 00:22:48 +0000 (00:22 +0000)]
Use isOSBinFormatMachO() instead of comparing the object format
against an enum.

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

9 years agoParse qualifiers after comma in declarator lists as a Microsoft extension
Nico Rieck [Thu, 4 Dec 2014 23:31:08 +0000 (23:31 +0000)]
Parse qualifiers after comma in declarator lists as a Microsoft extension

MSVC parses and ignores these with a warning.

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

9 years agoRecognize __unaligned keyword after type specifier
Nico Rieck [Thu, 4 Dec 2014 23:30:25 +0000 (23:30 +0000)]
Recognize __unaligned keyword after type specifier

The __unaligned keyword can appear after a struct definition:

  struct foo {...} __unaligned *x;

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

9 years agoAdding a FIXME to the code, based on a discussion in IRC; NFC.
Aaron Ballman [Thu, 4 Dec 2014 22:45:31 +0000 (22:45 +0000)]
Adding a FIXME to the code, based on a discussion in IRC; NFC.

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

9 years agoSilence warning: "NOMINMAX" redefined.
Yaron Keren [Thu, 4 Dec 2014 21:46:50 +0000 (21:46 +0000)]
Silence warning: "NOMINMAX" redefined.

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

9 years agoAdd attributes for AMDGPU register limits.
Matt Arsenault [Thu, 4 Dec 2014 20:38:18 +0000 (20:38 +0000)]
Add attributes for AMDGPU register limits.

This is a performance hint that can be applied to kernels
to attempt to limit the number of used registers.

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

9 years agoclang-format: [JS] Don't put top-level dict literals on a single line.
Daniel Jasper [Thu, 4 Dec 2014 16:07:17 +0000 (16:07 +0000)]
clang-format: [JS] Don't put top-level dict literals on a single line.

These are often used for enums which apparently are easier to read if
formatted with one element per line.

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

9 years agoFix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
Faisal Vali [Thu, 4 Dec 2014 12:40:21 +0000 (12:40 +0000)]
Fix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
should indicate a c++ parameter pack not a c-variadic.

int i = [](auto...) { return 0; }(); // OK now.

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

9 years agoMake getInsertArgumentAdjuster insert extra arguments to the end by default.
Alexander Kornienko [Thu, 4 Dec 2014 11:00:56 +0000 (11:00 +0000)]
Make getInsertArgumentAdjuster insert extra arguments to the end by default.

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

9 years agoclang-format: More restrictively classify import declarations.
Daniel Jasper [Thu, 4 Dec 2014 08:57:27 +0000 (08:57 +0000)]
clang-format: More restrictively classify import declarations.

Before:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                       aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

9 years ago[OPENMP] Codegen for 'omp master' directive
Alexey Bataev [Thu, 4 Dec 2014 07:23:53 +0000 (07:23 +0000)]
[OPENMP] Codegen for 'omp master' directive
Patch adds 2 library functions to OpenMPRuntime class - int32 kmpc_master(ident_t *, int32 gtid) and void kmpc_end_master(ident_t *, int32 gtid);
For 'omp master' directive the next code is generated:

if (__kmpc_master(loc, gtid)) {
    <Associated structured block>;
      __kmpc_end_master(log, gtid);
}

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

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

9 years agoAlways emit kernel arg info for SPIR.
Sameer Sahasrabuddhe [Thu, 4 Dec 2014 05:30:58 +0000 (05:30 +0000)]
Always emit kernel arg info for SPIR.

http://llvm.org/bugs/show_bug.cgi?id=21555

Currently, kernel argument metadata is omitted unless the
"-cl-kernel-arg-info" option is specified. But the SPIR 1.2 spec
requires that all metadata except kernel_arg_name should always be
emitted, and kernel_arg_name is only emitted when
"-cl-kernel-arg-info" is specified.

Patch ported by Ryan Burn from the Khronos SPIR generator.
https://github.com/KhronosGroup/SPIR

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

9 years agoCodeGen: refactor ARM builtin handling
Saleem Abdulrasool [Thu, 4 Dec 2014 04:52:37 +0000 (04:52 +0000)]
CodeGen: refactor ARM builtin handling

Create a helper function to construct a value for the ARM hint intrinsic
rather than inling the construction.  In order to avoid the use of the sentinel
value, inline the use of intrinsic instruction retrieval.  NFC.

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

9 years agoCMake: try to actually fix the regexes for setting HOST_LINK_VERSION this time (PR21268)
Hans Wennborg [Thu, 4 Dec 2014 01:59:58 +0000 (01:59 +0000)]
CMake: try to actually fix the regexes for setting HOST_LINK_VERSION this time (PR21268)

The regex should not accept an empty version number.

The previous attempt at r223106 failed, and the build was still erroring:

  CMake Error at tools/clang/CMakeLists.txt:269 (string):
    string sub-command REGEX, mode REPLACE regex "[^0-9]*([0-9.]*).*" matched
    an empty string.

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

9 years agoAdd test for __umulh
Reid Kleckner [Wed, 3 Dec 2014 23:52:26 +0000 (23:52 +0000)]
Add test for __umulh

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

9 years agoImplement __umulh with __int128 arithmetic
Reid Kleckner [Wed, 3 Dec 2014 23:36:14 +0000 (23:36 +0000)]
Implement __umulh with __int128 arithmetic

Use the same approach as _umul128, but just return the high half.

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

9 years ago[msan] allow -fsanitize-coverage=N together with -fsanitize=memory, clang part
Kostya Serebryany [Wed, 3 Dec 2014 23:27:45 +0000 (23:27 +0000)]
[msan] allow -fsanitize-coverage=N together with -fsanitize=memory, clang part

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

9 years agoCUDA host device code with two code paths
Reid Kleckner [Wed, 3 Dec 2014 21:53:36 +0000 (21:53 +0000)]
CUDA host device code with two code paths

Summary:
Allow CUDA host device functions with two code paths using __CUDA_ARCH__
to differentiate between code path being compiled.

For example:
  __host__ __device__ void host_device_function(void) {
  #ifdef __CUDA_ARCH__
    device_only_function();
  #else
    host_only_function();
  #endif
  }

Patch by Jacques Pienaar.

Reviewed By: rnk

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

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

9 years agoCast vtable address points to i32 (...)** to enable more globalopt
Reid Kleckner [Wed, 3 Dec 2014 21:00:21 +0000 (21:00 +0000)]
Cast vtable address points to i32 (...)** to enable more globalopt

We currently use i32 (...)** as the type of the vptr field in the LLVM
struct type. LLVM's GlobalOpt prefers any bitcasts to be on the side of
the data being stored rather than on the pointer being stored to.

Reviewers: majnemer

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

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

9 years agoTeach EvaluatedExprVisitor that the condition and unselected branches of a
Richard Smith [Wed, 3 Dec 2014 21:00:20 +0000 (21:00 +0000)]
Teach EvaluatedExprVisitor that the condition and unselected branches of a
_Generic expression are unevaluated.

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

9 years agoMake ArgumentsAdjuster an std::function.
Alexander Kornienko [Wed, 3 Dec 2014 17:53:02 +0000 (17:53 +0000)]
Make ArgumentsAdjuster an std::function.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

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

9 years agoFix isThreadModelSupported()'s comment. NFC
Jonathan Roelofs [Wed, 3 Dec 2014 17:04:52 +0000 (17:04 +0000)]
Fix isThreadModelSupported()'s comment. NFC

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

9 years agoclang-format: Fix fake parentheses placement with comments.
Daniel Jasper [Wed, 3 Dec 2014 14:02:59 +0000 (14:02 +0000)]
clang-format: Fix fake parentheses placement with comments.

Before:
  return (a > b
          // comment1
      // comment2
      || c);

After:
  return (a > b
      // comment1
      // comment2
      || c);

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

9 years agoclang-format: Fix expression parser not closing stuff at end of stmt.
Daniel Jasper [Wed, 3 Dec 2014 13:20:49 +0000 (13:20 +0000)]
clang-format: Fix expression parser not closing stuff at end of stmt.

Uncovered by a Java test case:

Before:
  public some.package.Type someFunction( // comment
      int parameter) {}

After:
  public some.package.Type someFunction( // comment
                          int parameter) {}

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

9 years ago[OPENMP] Code formatting and improvement, no functional changes.
Alexey Bataev [Wed, 3 Dec 2014 12:11:24 +0000 (12:11 +0000)]
[OPENMP] Code formatting and improvement, no functional changes.

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

9 years agoPreserve LD_LIBRARY_PATH when using the 'env' command
Hal Finkel [Wed, 3 Dec 2014 08:19:17 +0000 (08:19 +0000)]
Preserve LD_LIBRARY_PATH when using the 'env' command

In many Linux environments (and similar), just-built applications won't run
correctly without making use of the current LD_LIBRARY_PATH environmental
variable in order to find dynamic libraries. Propagate it through the 'env'
command (hopefully this works on all platforms).

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

9 years agoHandle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix.
Kaelyn Takata [Wed, 3 Dec 2014 05:30:54 +0000 (05:30 +0000)]
Handle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix.

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

9 years agoUpdate test to check for prologue instead of prefix
Peter Collingbourne [Wed, 3 Dec 2014 02:37:10 +0000 (02:37 +0000)]
Update test to check for prologue instead of prefix

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

9 years agoUBSan now uses prologue data instead of prefix data
Peter Collingbourne [Wed, 3 Dec 2014 02:08:51 +0000 (02:08 +0000)]
UBSan now uses prologue data instead of prefix data

As the semantics of prefix data has changed. See D6454.

Patch by Ben Gamari!

Test Plan: Testsuite

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

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

9 years agoAdd support for has_feature(cxx_alignof) and has_feature(c_alignof).
Nico Weber [Wed, 3 Dec 2014 01:25:49 +0000 (01:25 +0000)]
Add support for has_feature(cxx_alignof) and has_feature(c_alignof).

r142020 added support for has_feature(cxx_alignas). This does the same for
alignof.

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

9 years agoFix incorrect codegen for devirtualized calls to virtual overloaded operators.
Nico Weber [Wed, 3 Dec 2014 01:21:41 +0000 (01:21 +0000)]
Fix incorrect codegen for devirtualized calls to virtual overloaded operators.

Consider this program:

    struct A {
      virtual void operator-() { printf("base\n"); }
    };
    struct B final : public A {
      virtual void operator-() override { printf("derived\n"); }
    };

    int main() {
      B* b = new B;
      -static_cast<A&>(*b);
    }

Before this patch, clang saw the virtual call to A::operator-(), figured out
that it can be devirtualized, and then just called A::operator-() directly,
without going through the vtable.  Instead, it should've looked up which
operator-() the call devirtualizes to and should've called that.

For regular virtual member calls, clang gets all this right already. So
instead of giving EmitCXXOperatorMemberCallee() all the logic that
EmitCXXMemberCallExpr() already has, cut the latter function into two pieces,
call the second piece EmitCXXMemberOrOperatorMemberCallExpr(), and use it also
to generate code for calls to virtual member operators.

This way, virtual overloaded operators automatically don't get devirtualized
if they have covariant returns (like it was done for regular calls in r218602),
etc.

This also happens to fix (or at least improve) codegen for explicit constructor
calls (`A a; a.A::A()`) in MS mode with -fsanitize-address-field-padding=1.

(This adjustment for virtual operator calls seems still wrong with the MS ABI.)

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

9 years agoPR21706: -Wunsequenced was missing warnings when leaving a sequenced region that...
Richard Smith [Wed, 3 Dec 2014 01:05:50 +0000 (01:05 +0000)]
PR21706: -Wunsequenced was missing warnings when leaving a sequenced region that contained side effects.

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

9 years agoFullProduct should be _FullProduct
David Majnemer [Tue, 2 Dec 2014 23:44:40 +0000 (23:44 +0000)]
FullProduct should be _FullProduct

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

9 years agoEnsure typos in the default values of template parameters get diagnosed.
Kaelyn Takata [Tue, 2 Dec 2014 23:32:20 +0000 (23:32 +0000)]
Ensure typos in the default values of template parameters get diagnosed.

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

9 years agoIntrin: shrx_u64 should be _shrx_u64
David Majnemer [Tue, 2 Dec 2014 23:30:26 +0000 (23:30 +0000)]
Intrin: shrx_u64 should be _shrx_u64

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

9 years agoIntrin: Add _umul128
David Majnemer [Tue, 2 Dec 2014 23:30:24 +0000 (23:30 +0000)]
Intrin: Add _umul128

Implement _umul128; it provides the high and low halves of a 128-bit
multiply.  We can simply use our __int128 arithmetic to implement this,
we generate great code for it:
        movq    %rdx, %rax
        mulq    %rcx
        movq    %rdx, (%r8)
        retq

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

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

9 years agoInstrProf: Use the same names for variables as we use in the profile
Justin Bogner [Tue, 2 Dec 2014 23:15:30 +0000 (23:15 +0000)]
InstrProf: Use the same names for variables as we use in the profile

There's no need to use different names for the local variables than we
use in the profile itself, and it's a bit simpler and easier to debug
if we're consistent.

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

9 years agoAnother warning with no group name bites the dust.
Fariborz Jahanian [Tue, 2 Dec 2014 22:42:52 +0000 (22:42 +0000)]
Another warning with no group name bites the dust.
rdar://19116886

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

9 years agoInstrProf: Remove some pointless indirection (NFC)
Justin Bogner [Tue, 2 Dec 2014 22:38:52 +0000 (22:38 +0000)]
InstrProf: Remove some pointless indirection (NFC)

It doesn't make much sense to have std::unique_ptrs of std::string and
std::vector. Avoid some useless indirection by using these types
directly.

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

9 years agoDiagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.
Kaelyn Takata [Tue, 2 Dec 2014 22:05:35 +0000 (22:05 +0000)]
Diagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.

Also have CorrectDelayedTyposInExpr check that the Expr* isn't null
before trying to access its members. Fixes PR21679.

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

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Tue, 2 Dec 2014 20:41:18 +0000 (20:41 +0000)]
Wrap to 80 columns. No behavior change.

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

9 years agoMake le64 DescriptionString consistent with other targets.
JF Bastien [Tue, 2 Dec 2014 19:19:59 +0000 (19:19 +0000)]
Make le64 DescriptionString consistent with other targets.

Summary:
In particular, remove the defaults and reorder fields so it matches the result of DataLayout::getStringDescription().

Change by David Neto.

Reviewers: dschuff, sdt

Subscribers: cfe-commits

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

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

9 years agoThis patch fixes a crash involving use of predefined
Fariborz Jahanian [Tue, 2 Dec 2014 18:42:51 +0000 (18:42 +0000)]
This patch fixes a crash involving use of predefined
expressions. It fixes crash when mangling name for block's helper
function used inside a constructor/destructor.
rdar://19065361.

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

9 years agoSkip some unnecessary type checks.
Samuel Benzaquen [Tue, 2 Dec 2014 18:29:00 +0000 (18:29 +0000)]
Skip some unnecessary type checks.

Summary:
Skip some unnecessary type checks wrt DynTypedNodes.
Add DynTypedNode::getUnchecked() to skip the runtime check when the type
is known.
Speed up DynTypedNode::operator== by using isSame() instead of
isBaseOf().
Skip the type check in MatcherInterface<T>::matches(). All calls come
from DynTypedMatcher::matches(), which already did the type check.
This change speeds up our clang-tidy benchmark by ~4%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

9 years agoFix invalid calling convention used for libcalls on ARM.
Anton Korobeynikov [Tue, 2 Dec 2014 16:04:58 +0000 (16:04 +0000)]
Fix invalid calling convention used for libcalls on ARM.
ARM ABI specifies that all the libcalls use soft FP ABI
(even hard FP binaries). These days clang emits _mulsc3 / _muldc3
calls with default (C) calling convention which would be translated
into AAPCS_VFP LLVM calling and thus the result of complex
multiplication will be bogus.

Introduce a way for a target to specify explicitly calling
convention for libcalls. Right now this is temporary correctness
fix. Ultimately, we'll end with intrinsic for complex
multiplication and all calling convention decisions for libcalls
will be put into backend.

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

9 years agoReverted r223114, it caused failure on on clang-native-arm-cortex-a9.
Serge Pavlov [Tue, 2 Dec 2014 14:52:20 +0000 (14:52 +0000)]
Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.

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

9 years agoclang-format: Escape '*' in generated flag documentation.
Daniel Jasper [Tue, 2 Dec 2014 14:21:16 +0000 (14:21 +0000)]
clang-format: Escape '*' in generated flag documentation.

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

9 years agoclang-format: Add option to suppress operator alignment.
Daniel Jasper [Tue, 2 Dec 2014 13:24:51 +0000 (13:24 +0000)]
clang-format: Add option to suppress operator alignment.

With alignment:
  int aaaaaa = aa
               + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                     * cccccccccccccccccccccccccccccccc;

Without alignment:
  int aaaaaa = aa
      + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
          * cccccccccccccccccccccccccccccccc;

This fixes llvm.org/PR21666.

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

9 years ago[NVPTX] Fix type error for some builtins in BuiltinsNVPTX.def
Justin Holewinski [Tue, 2 Dec 2014 12:58:24 +0000 (12:58 +0000)]
[NVPTX] Fix type error for some builtins in BuiltinsNVPTX.def

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

9 years agoEmit warning if define or undef reserved identifier or keyword.
Serge Pavlov [Tue, 2 Dec 2014 11:06:09 +0000 (11:06 +0000)]
Emit warning if define or undef reserved identifier or keyword.

Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

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

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

9 years agoclang-format: precedence-based indentation when breaking before operators.
Daniel Jasper [Tue, 2 Dec 2014 09:46:56 +0000 (09:46 +0000)]
clang-format: precedence-based indentation when breaking before operators.

Before:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                  + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  > ccccccccccccccccccccccccccccccccccccccccc;

After:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                   == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                              * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                          + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                          * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      > ccccccccccccccccccccccccccccccccccccccccc;

Not particularly pretty, but can probably help to uncover bugs. And if this
bugs somebody, parentheses can help.

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

9 years agoRe-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a...
Bob Wilson [Tue, 2 Dec 2014 05:17:21 +0000 (05:17 +0000)]
Re-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a while."

This reverts commit r176892.

I had reverted this a while back to give Chromium more time to update, and
Nico says it should be OK now.

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