Serge Pavlov [Fri, 15 May 2015 10:10:28 +0000 (10:10 +0000)]
Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that
are referenced before definition. This change limit the set of types
that can be instantiated by this function.
Daniel Jasper [Fri, 15 May 2015 09:41:59 +0000 (09:41 +0000)]
clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.
Summary:
r235215 enables support in LLVM for legalizing f16 type in the IR. AArch64
already had support for this. r235215 and some backend patches brought support
for ARM, X86, X86-64, Mips and Mips64.
This change exposes the LangOption 'NativeHalfType' in the command line, so the
backend legalization can be used if desired. NativeHalfType is enabled for
OpenCL (current behavior) or if '-fnative-half-type' is set.
Justin Bogner [Thu, 14 May 2015 22:14:10 +0000 (22:14 +0000)]
InstrProf: Only disable coverage in built-in macros, not all system macros
The issue I was trying to solve in r236547 was about built-in macros,
but I disabled coverage in all system macros. This is actually a bit
of overkill, and makes the display of coverage around system macros
degrade unnecessarily. Instead, limit this to builtins specifically.
Nemanja Ivanovic [Thu, 14 May 2015 20:02:24 +0000 (20:02 +0000)]
Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
- powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).
Sergey Dmitrouk [Thu, 14 May 2015 19:58:03 +0000 (19:58 +0000)]
[CodeGen] Reuse stack space from unused function results
Summary:
Space on stack allocated for unused structures returned by functions was unused
even when it's lifetime didn't intersect with lifetime of any other objects that
could use the same space.
The test added also checks for named and auto objects. It seems to make sense
to have this all in one place.
Yaron Keren [Thu, 14 May 2015 06:53:31 +0000 (06:53 +0000)]
Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:
/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.
Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.
Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.
Richard Smith [Thu, 14 May 2015 04:00:59 +0000 (04:00 +0000)]
Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.
Richard Smith [Thu, 14 May 2015 00:45:20 +0000 (00:45 +0000)]
[modules] Fix a #include cycle when building a module for our builtin headers.
xmmintrin.h includes emmintrin.h and vice versa if SSE2 is enabled. We break
this cycle for a modules build, and instead make the xmmintrin.h module
re-export the immintrin.h module. Also included is a fix for an assert in the
serialization code if a module exports another module that was declared later
in the same module map.
Paul Robinson [Wed, 13 May 2015 22:33:50 +0000 (22:33 +0000)]
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.
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.
Paul Robinson [Wed, 13 May 2015 21:18:15 +0000 (21:18 +0000)]
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).
Aaron Ballman [Wed, 13 May 2015 18:06:48 +0000 (18:06 +0000)]
Made considerable updates to the documentation explaining how to add a new attribute to clang. Cleans up some of the existing wording, as well as adding new information and better explanations.
Richard Trieu [Tue, 12 May 2015 21:36:35 +0000 (21:36 +0000)]
Add a new error for unexpected semi-colon before closing delimiter.
Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or
'}', two errors and one note would emitted, and the parsing would get confused
to which scope it was in. This change consumes the semi-colon, recovers
parsing better, and emits only one error with a fix-it.
Artem Belevich [Tue, 12 May 2015 17:44:15 +0000 (17:44 +0000)]
Fixed double-free in case of module loading error.
GetOutputStream() owns the stream it returns pointer to and the
pointer should never be freed by us. When we fail to load and exit
early, unique_ptr still holds the pointer and frees it which leads to
compiler crash when CompilerInstance attempts to free it again.
Manuel Klimek [Tue, 12 May 2015 09:23:57 +0000 (09:23 +0000)]
Refactor clang-format's formatter.
Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
of the indent of levels across multiple annotated lines.
b) Put all responsibility for merging lines into the LineJoiner; make the
LineJoiner iterate over the lines so we never operate on a line that might
be merged later; this makes the interface safer to use.
c) Move formatting of the end-of-file whitespace into formatFirstToken.
Fix bugs that became obvious after the refactoring:
1. We would not format lines with offsets correctly inside nested blocks if
only the outer expression was affected:
int x = s({ // clang-format only this line
class X {
public:
// ^ this starts at the non-modified indnent level; previously we would
// not fix this, now we correctly outdent it.
void f();
};
});
2. We would incorrectly align comments across lines that do not have comments
for lines with nested blocks:
int expression; // with comment
int x = s({
int y; // comment
int z; // we would incorrectly align this comment with the comment on
// 'expression'
});
Alexey Bataev [Tue, 12 May 2015 08:35:28 +0000 (08:35 +0000)]
[OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.
'schedule' clause for combined directives requires additional processing. Special helper variable is generated, that is captured in the outlined parallel region for 'parallel for' region. This captured variable is used to store chunk expression from the 'schedule' clause in this 'parallel for' region.
Justin Bogner [Tue, 12 May 2015 06:30:48 +0000 (06:30 +0000)]
Driver: Fix a -Wshadow issue from r237091
The MachO toolchain has an isTargetIOSBased method, but it isn't
virtual so it isn't very meaningful to call it. After thinking about
this, I guess that putting this logic in the MachO class is a bit of a
layering violation anyway. Do this more like how we handle
AddLinkRuntimeLibArgs instead.
Eric Christopher [Tue, 12 May 2015 01:26:21 +0000 (01:26 +0000)]
Remove the code that pulled soft float attributes out of the feature
strings and remove the setting of TargetOptions::UseSoftFloat to
match the code change in llvm r237079.
Justin Bogner [Tue, 12 May 2015 00:31:33 +0000 (00:31 +0000)]
Driver: Make profiling flags work with -nostdlib on Darwin
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib
shouldn't prevent it from being linked. This makes Darwin behave like
other toolchains, and link in the profile runtime irrespective of
-nostdlib, since the resulting program can't be run unless you link
this.
I've also added a test to show that other toolchains already behave
like this.
Steven Wu [Tue, 12 May 2015 00:16:37 +0000 (00:16 +0000)]
Allow empty assembly string literal with -fno-gnu-inline-asm
Empty assembly string will not introduce assembly code in the output
binary and it is often used as a trick in the header to disable
optimizations. It doesn't conflict with the purpose of the option so it
is allowed with -fno-gnu-inline-asm flag.
Richard Smith [Mon, 11 May 2015 23:09:06 +0000 (23:09 +0000)]
PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.
This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.
Patch by Michael Park!
This re-commits r236063, which was reverted in r236134, along with a fix for a
delayed template parsing bug that was exposed by this change.
Steven Wu [Mon, 11 May 2015 21:14:09 +0000 (21:14 +0000)]
Allow AsmLabel with -fno-gnu-inline-asm
Summary:
AsmLabel is heavily used in system level and firmware to redirect
function and access platform specific labels. They are also extensively
used in system headers which makes this option unusable for many
users. Since AsmLabel doesn't introduce any assembly code into the
output binary, it shouldn't be considered as inline-asm.
Aaron Ballman [Mon, 11 May 2015 14:09:50 +0000 (14:09 +0000)]
Disable __has_cpp_attribute when not compiling in C++ mode. As this feature test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute.
Daniel Jasper [Mon, 11 May 2015 13:35:40 +0000 (13:35 +0000)]
clang-format: Improve column layout.
Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.
Manuel Klimek [Mon, 11 May 2015 08:21:35 +0000 (08:21 +0000)]
Refactor the formatter of clang-format.
Pull various parts of the UnwrappedLineFormatter into their own
abstractions. NFC.
There are two things left for subsequent changes (to keep this
reasonably small)
- the UnwrappedLineFormatter now has a bad name
- the UnwrappedLineFormatter::format function is still too large