Commit Graph

1098 Commits

Author SHA1 Message Date
Nico Weber 736a993828 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.

llvm-svn: 223186
2014-12-03 01:25:49 +00:00
Daniel Jasper 7f43266778 clang-format: Escape '*' in generated flag documentation.
llvm-svn: 223118
2014-12-02 14:21:16 +00:00
Daniel Jasper 3219e43c94 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.

llvm-svn: 223117
2014-12-02 13:24:51 +00:00
Manuel Klimek d3aa1f4a63 Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Change to original: ifndef out tests in Windows due to /-separated
paths.

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

llvm-svn: 222765
2014-11-25 17:01:06 +00:00
Daniel Jasper 21a0f55755 Add flag -f(no-)modules-implicit-maps.
This suppresses the implicit search for files called 'module.modulemap' and
similar.

llvm-svn: 222745
2014-11-25 09:45:48 +00:00
David Majnemer 442d0a2e5a MS ABI: Add CodeGen support for rethrowing MS C++ exceptions
Rethrowing exceptions in the MS model is very simple: just call
_CxxThrowException with nullptr for both arguments.

N.B.  They chose stdcall as the calling convention for x86 but cdecl for
all other platforms.

llvm-svn: 222733
2014-11-25 07:20:20 +00:00
David Majnemer 81537b5c8e docs: Update the MSVCCompatibility doc for changes to debug info
The document should reflect that we now support emission for DWARF.

llvm-svn: 222731
2014-11-25 06:59:35 +00:00
Aaron Ballman 6265102c17 Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.
llvm-svn: 222667
2014-11-24 17:39:44 +00:00
Manuel Klimek da50ff8e4a Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

llvm-svn: 222646
2014-11-24 09:10:56 +00:00
Aaron Ballman 631bd7b110 Oops, the underline was too short for sphinx to like.
llvm-svn: 221993
2014-11-14 14:01:55 +00:00
Aaron Ballman eb1e2f213a Correcting some grammar and typos, and adding CERT as a collaborator.
llvm-svn: 221992
2014-11-14 13:48:34 +00:00
Aaron Ballman a0344c5d7b Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
2014-11-14 13:44:02 +00:00
Richard Smith 38af8561f9 Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816
2014-11-12 21:16:38 +00:00
Saleem Abdulrasool 8bbed0b63a docs: remove double carriage-return
The double carriage return would silence a warning due to a missing
.clang-format.  Permit the error to bubble through.

llvm-svn: 221107
2014-11-02 21:27:52 +00:00
Daniel Jasper eb2226e4bd clang-format: Update generated documentation with new flag.
llvm-svn: 220786
2014-10-28 16:56:37 +00:00
Saleem Abdulrasool 1f060a8552 clang-format: improve vim integration docs
Improve the documentation for vim integration of clang-format.  Prefer the use
of <c-o> to do the normal mode command execution to avoid side-effects of the
escape and re-insertion (cursor movement).  Tweak the macros to use a double
return to avoid having to manually return control to the editor from the
subprocess.

llvm-svn: 220685
2014-10-27 17:13:33 +00:00
Richard Smith 202210b369 [modules] Support combining 'textual' with 'private'.
llvm-svn: 220589
2014-10-24 20:23:01 +00:00
Nick Lewycky d935be3568 Update the documentation for API change to CreateASTConsumer the rest of the way.
llvm-svn: 220450
2014-10-22 23:57:14 +00:00
Richard Smith 306d892076 [modules] Add support for 'textual header' directives.
This allows a module to specify that it logically contains a file, but that
said file is non-modular and intended for textual inclusion. This allows
layering checks to work properly in the presence of such files.

llvm-svn: 220448
2014-10-22 23:50:56 +00:00
Nick Lewycky dadf408680 Add missing qualifier to documentation.
llvm-svn: 220268
2014-10-21 06:44:23 +00:00
Nick Lewycky 185733eff9 Update documentation to match API change in r215323.
llvm-svn: 220267
2014-10-21 06:43:08 +00:00
Richard Smith ab506adf7d Switch C compilations to C11 by default.
This is long-since overdue, and matches GCC 5.0. This should also be
backwards-compatible, because we already supported all of C11 as an extension
in C99 mode.

llvm-svn: 220244
2014-10-20 23:26:58 +00:00
Richard Smith 25d50758f3 [modules] Add support for #include_next.
#include_next interacts poorly with modules: it depends on where in the list of
include paths the current file was found. Files covered by module maps are not
found in include search paths when building the module (and are not found in
include search paths when @importing the module either), so this isn't really
meaningful. Instead, we fake up the result that #include_next *should* have
given: find the first path that would have resulted in the given file being
picked, and search from there onwards.

llvm-svn: 220177
2014-10-20 00:15:49 +00:00
Alexey Samsonov a0ac3c2bf0 [ASan] Improve blacklisting of global variables.
This commit changes the way we blacklist global variables in ASan.
Now the global is excluded from instrumentation (either regular
bounds checking, or initialization-order checking) if:

1) Global is explicitly blacklisted by its mangled name.
This part is left unchanged.

2) SourceLocation of a global is in blacklisted source file.
This changes the old behavior, where instead of looking at the
SourceLocation of a variable we simply considered llvm::Module
identifier. This was wrong, as identifier may not correspond to
the file name, and we incorrectly disabled instrumentation
for globals coming from #include'd files.

3) Global is blacklisted by type.
Now we build the type of a global variable using Clang machinery
(QualType::getAsString()), instead of llvm::StructType::getName().

After this commit, the active users of ASan blacklist files
may have to revisit them (this is a backwards-incompatible change).

llvm-svn: 220097
2014-10-17 22:37:33 +00:00
JF Bastien e6ccacf9b0 Fix documentation typo.
llvm-svn: 219509
2014-10-10 16:09:48 +00:00
Manuel Klimek 7735e40a87 Implement various matchers around template argument handling.
llvm-svn: 219408
2014-10-09 13:06:22 +00:00
Aaron Ballman 201b94e63f Escaping a special character in the documentation.
llvm-svn: 219407
2014-10-09 13:03:12 +00:00
Daniel Jasper 18210d7d2f clang-format: Add option to control call argument bin-packing separately
This is desirable for the Chromium style guide:
http://www.chromium.org/developers/coding-style

llvm-svn: 219400
2014-10-09 09:52:05 +00:00
Daniel Jasper d8b4ec0dad clang-format: Add documentation about disabling formatting.
Patch by Marek Kurdej, thanks!

llvm-svn: 219204
2014-10-07 12:15:15 +00:00
Eli Bendersky 11b6badd7b Update title of the ReleaseNodes doc.
It was still "3.5 (In-Progress)" - should be 3.6

llvm-svn: 219153
2014-10-06 22:45:17 +00:00
Dan Liew fe7268600d [sphinx clean up] Fix warning introduced by r218957
llvm-svn: 218983
2014-10-03 12:36:20 +00:00
Hal Finkel 6970ac8b0a Add an implementation of C11's stdatomic.h
Adds a Clang-specific implementation of C11's stdatomic.h header. On systems,
such as FreeBSD, where a stdatomic.h header is already provided, we defer to
that header instead (using our __has_include_next technology). Otherwise, we
provide an implementation in terms of our __c11_atomic_* intrinsics (that were
created for this purpose).

C11 7.1.4p1 requires function declarations for atomic_thread_fence,
atomic_signal_fence, atomic_flag_test_and_set,
atomic_flag_test_and_set_explicit, and atomic_flag_clear, and requires that
they have external linkage. Accordingly, we provide these declarations, but if
a user elides the shadowing macros and uses them, then they must have a libc
(or similar) that actually provides definitions.

atomic_flag is implemented using _Bool as the underlying type. This is
consistent with the implementation provided by FreeBSD and also GCC 4.9 (at
least when __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1).

Patch by Richard Smith (rebased and slightly edited by me -- Richard said I
should drive at this point).

llvm-svn: 218957
2014-10-03 04:29:40 +00:00
Richard Smith ffb650856d Enable both C and C++ modules with -fmodules, by switching -fcxx-modules to
being on by default. -fno-cxx-modules can still be used to enable C modules but
not C++ modules, but C++ modules is not significantly less stable than C
modules any more.

Also remove some of the scare words from the modules documentation. We're
certainly not going to remove modules support (though we might change the
interface), and it works well enough to bootstrap and build lots of
non-trivial code.

Note that this does not represent a commitment to the current interface nor
implementation, and we still intend to follow whatever direction the C and C++
committees take regarding modules support.

llvm-svn: 218717
2014-09-30 23:10:19 +00:00
Richard Smith bf65300f3f Update modules documentation now that C++ support is working pretty well.
llvm-svn: 218614
2014-09-29 17:46:41 +00:00
Jyoti Allur 7d9f67f76e testing commit access to clang repo
llvm-svn: 218592
2014-09-29 06:23:54 +00:00
DeLesley Hutchins 0d1ce2f199 Thread Safety Analysis: Update to documentation.
The attribute documentation now conforms to Aaron Ballman's renaming of the
thread safety attributes, as well as the new paper that is due to be published
in the conference on Source Code Analysis and Manipulation (SCAM 2014) later
this week.  In addition, recent changes to the analysis, such as checking
of references and negative capabilities, are now documented.

llvm-svn: 218420
2014-09-24 22:13:34 +00:00
Nico Weber acb35c0272 Change -Wbind-to-temporary-copy from an ExtWarn to an Extension.
The reasoning is that this construct is accepted by all compilers and valid in
C++11, so it doesn't seem like a useful warning to have enabled by default.
Building with -pedantic, -Wbind-to-temporary-copy, or -Wc++98-compat still
shows the warning.

The motivation is that I built re2, and this was the only warning that was
emitted during the build. Both changing re2 to fix the warning and detecting
clang and suppressing the warning in re2's build seem inferior than just giving
the compiler a good default for this warning.

Also move the cxx98compat version of this warning to CXX98CompatPedantic, and
update tests accordingly.

llvm-svn: 218008
2014-09-18 02:09:53 +00:00
Dan Liew e41d8e3923 [sphinx cleanup]
Fix warning introduced by r211098.

llvm-svn: 217864
2014-09-16 08:44:27 +00:00
Daniel Jasper ac043c900c clang-format: Add option to break before non-assignment operators.
This will allow:
  int aaaaaaaaaaaaaa =
      bbbbbbbbbbbbbb
      + ccccccccccccccc;

llvm-svn: 217757
2014-09-15 11:11:00 +00:00
Dan Liew 1c9547ed51 [sphinx cleanup]
Fix sphinx warning introduced by r217501.

llvm-svn: 217524
2014-09-10 17:26:21 +00:00
Daniel Jasper b87899b567 clang-format: Add option to allow short case labels on a single line.
On a single line:
  switch (a) {
  case 1: x = 1; return;
  case 2: x = 2; return;
  default: break;
  }

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

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

llvm-svn: 217501
2014-09-10 13:11:45 +00:00
Alexey Samsonov 8e1162c71d Implement nonnull-attribute sanitizer
Summary:
This patch implements a new UBSan check, which verifies
that function arguments declared to be nonnull with __attribute__((nonnull))
are actually nonnull in runtime.

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

Test Plan: regression test suite

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, rnk

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

llvm-svn: 217389
2014-09-08 17:22:45 +00:00
Hal Finkel bcc06085a8 Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.
This makes use of the recently-added @llvm.assume intrinsic to implement a
__builtin_assume(bool) intrinsic (to provide additional information to the
optimizer). This hooks up __assume in MS-compatibility mode to mirror
__builtin_assume (the semantics have been intentionally kept compatible), and
implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM
now contains special logic to deal with assumptions of this form.

llvm-svn: 217349
2014-09-07 22:58:14 +00:00
Manuel Klimek 94ad0bf10d Add matcher for linkage specification
Patch by Jacques Pienaar.

llvm-svn: 217135
2014-09-04 08:51:06 +00:00
Anton Yartsev 94e46f3eb8 Enhance the 'Vectors and Extended Vectors' section.
Added cast operations to the table of vector operations. Supported status 'no' means that there are no tests in the Clang test suite for the given cast.

llvm-svn: 217055
2014-09-03 17:59:21 +00:00
Daniel Jasper db986eb6bb clang-format: Add an option 'SpaceAfterCStyleCast'.
This permits to add a space after closing parenthesis of a C-style cast.
Defaults to false to preserve old behavior.

Fixes llvm.org/PR19982.

Before:
  (int)i;

After:
  (int) i;

Patch by Marek Kurdej.

llvm-svn: 217022
2014-09-03 07:37:29 +00:00
Yunzhong Gao 637cb90ba8 Fixing a typo in the documented __builtin_convertvector example.
"vf[0]" ==> "vs[0]"

llvm-svn: 216935
2014-09-02 19:24:14 +00:00
David Blaikie e90195c09b unique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFG
llvm-svn: 216755
2014-08-29 18:53:26 +00:00
Daniel Jasper ad981f888a clang-format: New option SpacesInSquareBrackets.
Before:
  int a[5];
  a[3] += 42;

After:
  int a[ 5 ];
  a[ 3 ] += 42;

Fixes LLVM bug #17887 (http://llvm.org/bugs/show_bug.cgi?id=17887).

Patch by Marek Kurdej, thank you!

llvm-svn: 216449
2014-08-26 11:41:14 +00:00
Manuel Klimek 3fe8a38110 Add hasAttr matcher for declarations.
Delete special-case CUDA attribute matchers.

Patch by Jacques Pienaar.

llvm-svn: 216379
2014-08-25 11:23:50 +00:00