Commit Graph

242 Commits

Author SHA1 Message Date
NAKAMURA Takumi ba7d0fe280 Revert r260266 (and r260276), "clang-cl: Enable plugins on Windows"
It doesn't work, at least, i686-win32.

llvm-svn: 260537
2016-02-11 16:43:08 +00:00
Ehsan Akhgari b55b9ff884 Fix the test added in r260266
llvm-svn: 260276
2016-02-09 20:49:24 +00:00
Ehsan Akhgari 48e8d8bcdd clang-cl: Enable plugins on Windows
llvm-svn: 260266
2016-02-09 19:43:13 +00:00
Oliver Stannard 9181785a0c Add backend dignostic printer for unsupported features
Re-commit of r258950 after fixing layering violation.

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

llvm-svn: 259499
2016-02-02 13:52:52 +00:00
Oliver Stannard 92d4c328d1 Revert r259036, it introduces a cyclic library dependency
llvm-svn: 259043
2016-01-28 13:09:49 +00:00
Oliver Stannard 7a964feccb Add backend dignostic printer for unsupported features
Re-commit of r258950 after fixing layering violation.

Add backend dignostic printer for unsupported features

The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

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

llvm-svn: 259036
2016-01-28 10:07:34 +00:00
NAKAMURA Takumi 628a7a0aef Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported features"
It broke layering violation in LLVMIR.

clang r258950 "Add backend dignostic printer for unsupported features"
llvm  r258951 "Refactor backend diagnostics for unsupported features"

llvm-svn: 259016
2016-01-28 04:41:32 +00:00
Oliver Stannard 5e03a4b837 Add backend dignostic printer for unsupported features
The related LLVM patch adds a backend diagnostic type for reporting
unsupported features, this adds a printer for them to clang.

In the case where debug location information is not available, I've
changed the printer to report the location as the first line of the
function, rather than the closing brace, as the latter does not give the
user any information. This also affects optimisation remarks.

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

llvm-svn: 258950
2016-01-27 17:30:28 +00:00
Tim Northover 67465f80ec Preprocessor: define correct tvOS and watchOS version macros
llvm-svn: 251707
2015-10-30 16:30:30 +00:00
Reid Kleckner afb9aaefe3 Add back null check removed accidentally in r250554
Fixes PR25262

llvm-svn: 250844
2015-10-20 18:45:57 +00:00
Douglas Katzman 3459ce2e5e Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

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

llvm-svn: 249655
2015-10-08 04:24:12 +00:00
Dehao Chen 1b68ebf3a0 Fix the sample profile format that breaks in test http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/505
http://reviews.llvm.org/D13145

llvm-svn: 248869
2015-09-30 01:03:10 +00:00
Evgeniy Stepanov 6b2a61d3a5 Revert "Always_inline codegen rewrite" and 2 follow-ups.
Revert "Update cxx-irgen.cpp test to allow signext in alwaysinline functions."
Revert "[CodeGen] Remove wrapper-free always_inline functions from COMDATs"
Revert "Always_inline codegen rewrite."

Reason for revert: PR24793.

llvm-svn: 247620
2015-09-14 21:35:16 +00:00
Evgeniy Stepanov 93db40a147 Always_inline codegen rewrite.
Current implementation may end up emitting an undefined reference for
an "inline __attribute__((always_inline))" function by generating an
"available_externally alwaysinline" IR function for it and then failing to
inline all the calls. This happens when a call to such function is in dead
code. As the inliner is an SCC pass, it does not process dead code.

Libc++ relies on the compiler never emitting such undefined reference.

With this patch, we emit a pair of
1. internal alwaysinline definition (called F.alwaysinline)
2a. A stub F() { musttail call F.alwaysinline }
  -- or, depending on the linkage --
2b. A declaration of F.

The frontend ensures that F.inlinefunction is only used for direct
calls, and the stub is used for everything else (taking the address of
the function, really). Declaration (2b) is emitted in the case when
"inline" is meant for inlining only (like __gnu_inline__ and some
other cases).

This approach, among other nice properties, ensures that alwaysinline
functions are always internal, making it impossible for a direct call
to such function to produce an undefined symbol reference.

This patch is based on ideas by Chandler Carruth and Richard Smith.

llvm-svn: 247494
2015-09-12 01:07:37 +00:00
Evgeniy Stepanov 67037ee21e Revert "Specify target triple in alwaysinline tests."
Revert "Always_inline codegen rewrite."

Breaks gdb & lldb tests.
Breaks on Fedora 22 x86_64.

llvm-svn: 247491
2015-09-11 23:48:37 +00:00
Evgeniy Stepanov 072e83500e Always_inline codegen rewrite.
Current implementation may end up emitting an undefined reference for
an "inline __attribute__((always_inline))" function by generating an
"available_externally alwaysinline" IR function for it and then failing to
inline all the calls. This happens when a call to such function is in dead
code. As the inliner is an SCC pass, it does not process dead code.

Libc++ relies on the compiler never emitting such undefined reference.

With this patch, we emit a pair of
1. internal alwaysinline definition (called F.alwaysinline)
2a. A stub F() { musttail call F.alwaysinline }
  -- or, depending on the linkage --
2b. A declaration of F.

The frontend ensures that F.inlinefunction is only used for direct
calls, and the stub is used for everything else (taking the address of
the function, really). Declaration (2b) is emitted in the case when
"inline" is meant for inlining only (like __gnu_inline__ and some
other cases).

This approach, among other nice properties, ensures that alwaysinline
functions are always internal, making it impossible for a direct call
to such function to produce an undefined symbol reference.

This patch is based on ideas by Chandler Carruth and Richard Smith.

llvm-svn: 247465
2015-09-11 20:29:07 +00:00
Yaron Keren d2fc591c0b This test requires UTF-8 output to print the UT-8 characters.
llvm-svn: 247410
2015-09-11 13:29:12 +00:00
Ivan Krasin 4c3f237edb Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.
Summary:
Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

Introduce a frontend option -fdepfile-entry, and only insert them
for the user-defined sanitizer blacklists. In frontend, grab ExtraDeps
from -fdepfile-entry, instead of -fsanitize-blacklist.

Reviewers: rsmith, pcc

Subscribers: cfe-commits

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

llvm-svn: 246700
2015-09-02 20:02:38 +00:00
Tyler Nowicki 8cb274ed0d Improve options printed on vectorization analysis diagnostics.
The LLVM patch changes the analysis diagnostics produced when loops with            
floating-point recurrences or memory operations are identified. The new messages
say "cannot prove it is safe to reorder * operations; allow reordering by       
specifying #pragma clang loop vectorize(enable)". Depending on the type of      
diagnostic the message will include additional options such as ffast-math or    
__restrict__.                                                                   

llvm-svn: 246189
2015-08-27 18:58:34 +00:00
Ivan Krasin 9cc0420211 Remove test cases, which rely on the default sanitizer blacklists.
Summary:
The default blacklists may vary across different architectures and
configurations. It was not wise to include into http://reviews.llvm.org/D11968

Reviewers: chapuni, pcc

Subscribers: cfe-commits, pcc

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

llvm-svn: 244985
2015-08-13 23:37:28 +00:00
NAKAMURA Takumi a137bf9386 clang/test/Frontend/dependency-gen.c: Add explicit -target x86_64-linux-gnu for -fsanitize.
llvm-svn: 244970
2015-08-13 22:17:34 +00:00
Yaron Keren b768f77ed6 Disable failing check in bots from r244867.
llvm-svn: 244869
2015-08-13 06:12:49 +00:00
Ivan Krasin 1193f2cbc0 Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.
Summary:
Clang sanitizers, such as AddressSanitizer, ThreadSanitizer, MemorySanitizer,
Control Flow Integrity and others, use blacklists to specify which types / functions
should not be instrumented to avoid false positives or suppress known failures.

This change adds the blacklist filenames to the list of dependencies of the rules,
generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that certain
C/C++/ObjC files need to be recompiled (if a blacklist is updated).

Reviewers: pcc

Subscribers: rsmith, honggyu.kim, pcc, cfe-commits

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

llvm-svn: 244867
2015-08-13 04:04:37 +00:00
Tyler Nowicki 26cee3d929 Make the analysis reporting test with x86 to fix the hexagon build.
llvm-svn: 244561
2015-08-11 01:54:48 +00:00
Tyler Nowicki 65061a293b Print vectorization analysis when loop hint is specified.
This patche and a related llvm patch solve the problem of having to explicitly enable analysis when specifying a loop hint pragma to get the diagnostics. Passing AlwasyPrint as the pass name (see below) causes the front-end to print the diagnostic if the user has specified '-Rpass-analysis' without an '=<target-pass>’. Users of loop hints can pass that compiler option without having to specify the pass and they will get diagnostics for only those loops with loop hints.

llvm-svn: 244556
2015-08-11 01:10:08 +00:00
Tyler Nowicki 034baf6154 Append options for vectorization when pointer checking threshold is exceeded.
Following one of the appended options will allow the loop to be vectorized. We do not include a command line option for modifying the pointer checking threshold because there is no clang-level interface for this currently.

llvm-svn: 244526
2015-08-10 23:05:16 +00:00
Tyler Nowicki 020dd79fb7 Make frontend floating-point commutivity test X86 specific to avoid cost-model related problems on arm-thumb and hexagon.
llvm-svn: 244517
2015-08-10 22:17:40 +00:00
Tyler Nowicki 40e5d08a74 Remove non-ascii characters.
llvm-svn: 244506
2015-08-10 21:18:01 +00:00
Tyler Nowicki 8a0925cb62 Append options for floating-point commutivity when related diagnostics are produced.
With this patch clang appends the command line options that would allow vectorization when floating-point commutativity is required. Specifically those are enabling fast-math or specifying a loop hint. 

llvm-svn: 244492
2015-08-10 19:56:40 +00:00
Adrian Prantl bc068586ac Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp.

llvm-svn: 241653
2015-07-08 01:00:30 +00:00
Adrian Prantl 142ec39739 Revert r241620 and follow-up commits while investigating linux buildbot failures.
llvm-svn: 241642
2015-07-07 23:19:46 +00:00
Adrian Prantl e50371b948 Wrap clang modules and pch files in an object file container.
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend
to put the contents of a PCH into a __clangast section inside a COFF, ELF,
or Mach-O object file container.

This is done to facilitate module debugging by makeing it possible to
store the debug info for the types defined by a module alongside the AST.

rdar://problem/20091852

llvm-svn: 241620
2015-07-07 20:11:29 +00:00
Richard Smith 3d8fceafe6 Commit some test changes somehow missed in r239789.
llvm-svn: 239791
2015-06-16 00:19:29 +00:00
Eric Fiselier 098e6de9aa Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer
Summary:
The goal of this patch is to make `-verify` easier to use when testing libc++. The `notes` attached to compile error diagnostics are numerous and relatively unstable when they reference libc++ header internals. This patch allows libc++ to write stable compilation failure tests by allowing unexpected diagnostic messages to be ignored where they are not relevant.

This patch adds a new CC1 flag called `-verify-ignore-unexpected`. `-verify-ignore-unexpected` tells `VerifyDiagnosticsConsumer` to ignore *all* unexpected diagnostic messages. `-verify-ignore-unexpected=<LevelList>` can be used to only ignore certain diagnostic levels. `<LevelList>` is a comma separated list of diagnostic levels to ignore. The supported levels are `note`, `remark`, `warning` and `error`.



Reviewers: bogner, grosser, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 239665
2015-06-13 07:11:40 +00:00
James Y Knight 4c5901eefc Fix fragile source-col-map.c test-case.
The test passing was dependent upon your source tree being checked out
in a directory with a long enough path, to cause the diagnostics to
wrap at the expected locations.

Use stdin instead, so that the error messages consistently use
<stdin> as the filename, and get wrapped consistently.

llvm-svn: 239009
2015-06-04 04:15:33 +00:00
Nico Weber 28e0f243cf Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.
In -fdelayed-template-parsing mode, templates that aren't used are not parsed
at all.  For some diagnostic plugins, this is a problem since they want to
analyse the contents of the template function body.  What has been suggested
on cfe-dev [1] is to explicitly parse interesting templates in
HandleTranslationUnit(); IWYU does this for example [2].

This is workable, but since the delayed parsing doesn't run below a call to
ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the
stack to clean up TemplateIds that are created during parsing.  To fix this,
let ~Parser() clean them up in delayed template parsing mode instead of
leaking (or asserting in +Assert builds).

(r219810, relanded in r220400, fixed the same problem in incremental processing
mode; the review thread of r219810 has a good discussion of the problem.)

To test this, give the PrintFunctionNames plugin a flag to force parsing
of a template and add a test that uses it in -fdelayed-template-parsing mode.
Without the Parser.cpp change, that test asserts.

1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html
2: https://code.google.com/p/include-what-you-use/source/detail?r=566 
llvm-svn: 237531
2015-05-17 01:07:16 +00:00
NAKAMURA Takumi 55deb26613 clang/test/Frontend/dependency-gen-escaping.c: Appease win32 hosts. Investigating.
FIXME: Do we really emit single \ or escaped \\ along the context with -fms-compatibility -MG?
llvm-svn: 237347
2015-05-14 07:37:35 +00:00
NAKAMURA Takumi 01477e5d6a clang/test/Frontend/dependency-gen-escaping.c: Tweak r237296, to let '/' and '\\' distinguishd, to unbreak "--host=linux --target=msvc".
llvm-svn: 237333
2015-05-14 04:25:54 +00:00
Paul Robinson fcdf3e9fe7 Break \# in a depfile the same way as gcc.
Backslash followed by # in a filename should have both characters
escaped, if you do it the way GNU Make wants.  GCC doesn't, so we do
it the way GCC does rather than the way GNU Make wants.

llvm-svn: 237304
2015-05-13 22:33:50 +00:00
Peter Collingbourne 470d94247d Make GNUInline consistent with whether we use traditional GNU inline semantics.
Previously we were setting LangOptions::GNUInline (which controls whether we
use traditional GNU inline semantics) if the language did not have the C99
feature flag set. The trouble with this is that C++ family languages also
do not have that flag set, so we ended up setting this flag in C++ modes
(and working around it in a few places downstream by also checking CPlusPlus).

The fix is to check whether the C89 flag is set for the target language,
rather than whether the C99 flag is cleared. This also lets us remove most
CPlusPlus checks. We continue to test CPlusPlus when deciding whether to
pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC.

There is a change in semantics in two other places
where we weren't checking both CPlusPlus and GNUInline
(FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and
FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to
put us back into line with GCC's semantics (test case: test/CodeGen/inline.c).

While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it,
it didn't have any effect before, and supporting it just makes things more
complicated.

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

llvm-svn: 237299
2015-05-13 22:07:22 +00:00
Paul Robinson 64441def58 Fix dependency file escaping.
When writing a dependency (.d) file, if space or # is immediately
preceded by one or more backslashes, escape the backslashes as well as
the space or # character. Otherwise leave backslash alone.
This straddles the fence between BSD Make (which does no escaping at
all, and does not support space or # in filespecs) and GNU Make (which
does support escaping, but will fall back to the filespec as-written
if the escaping doesn't match an existing file).

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

llvm-svn: 237296
2015-05-13 21:18:15 +00:00
Paul Robinson d101ca21e6 Simplify depfile quoting test.
With -MG we don't actually need to create the files with funky names.
Also use a more sensible check-prefix for the NMAKE case.

llvm-svn: 235908
2015-04-27 19:40:04 +00:00
Paul Robinson d7214a7651 Support generating NMake/Jom-style depfiles.
NMake is a Make-like builder that comes with Microsoft Visual Studio.
Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool.
Dependency files for NMake/Jom need to use double-quotes to wrap
filespecs containing special characters, instead of the backslash
escapes that GNU Make wants.

Adds the -MV option, which specifies to use double-quotes as needed
instead of backslash escapes when writing the dependency file.

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

llvm-svn: 235903
2015-04-27 18:14:32 +00:00
Matthias Braun dae4bac847 Fix typo in my last commit.
llvm-svn: 231039
2015-03-03 00:12:08 +00:00
Reid Kleckner acbd23adf1 Remove shell requirements from tests that use 'cd'
Modules and Tooling tests in particular tend to want to change the cwd,
so we were missing test coverage in this area on Windows. It should now
be easier to write such portable tests.

llvm-svn: 231029
2015-03-02 22:42:58 +00:00
Matthias Braun e0fc8cabda Improve robustness of dependency-generation-crash.c test.
The test wants to provoke a failure when opening the output file.
Using chmod 0 on the output file does not work reliably on all
filesystems or when running the test as root.
Change the test to use a nonexistant directory instead.

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

llvm-svn: 231009
2015-03-02 20:44:09 +00:00
Reid Kleckner 1df0fea593 Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.

If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.

Fixes PR20553.

Reviewers: rsmith

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

llvm-svn: 230587
2015-02-26 00:17:25 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Dmitri Gribenko 78a38c9f6d Fix copy-paste errors in the test
llvm-svn: 230272
2015-02-23 22:08:10 +00:00