Reid Kleckner [Sat, 17 Oct 2015 00:19:04 +0000 (00:19 +0000)]
Diagnose UnresolvedLookupExprs that resolve to instance members in static methods
During the initial template parse for this code, 'member' is unresolved
and we don't know anything about it:
struct A { int member };
template <typename T>
struct B : public T {
using T::member;
static void f() {
(void)member; // Could be static or non-static.
}
};
template class B<A>;
The pattern declaration contains an UnresolvedLookupExpr rather than an
UnresolvedMemberExpr because `f` is static, and `member` should never be
a field. However, if the code is invalid, it may become a field, in
which case we should diagnose it.
Richard Smith [Fri, 16 Oct 2015 23:20:19 +0000 (23:20 +0000)]
[modules] Allow the error when explicitly loading an incompatible module file
via -fmodule-file= to be turned off; in that case, just include the relevant
files textually. This allows module files to be unconditionally passed to all
compile actions via CXXFLAGS, and to be ignored for rules that specify custom
incompatible flags.
Richard Barton [Fri, 16 Oct 2015 20:15:29 +0000 (20:15 +0000)]
Further increase helfulness of assert message
If you increase the number of diags of a particular type by one more than the
number available you get the nice assert message. If you do it by two more
than available you get the old non-helpful message. Combining the two makes
sense I think.
r246877 made __builtin_object_size substantially more aggressive with
unknown bases if Type=1 or Type=3, which causes issues when we encounter
code like this:
__builtin_object_size(&f->str, 1) would hand back 1, which is
technically correct given the type of Foo, but the type of Foo lies to
us about how many bytes are available in this case.
This patch adds support for this "writing off the end" idiom -- we now
answer conservatively when we're given the address of the very last
member in a struct.
Previously, our logic when taking the address of an overloaded function
would not consider enable_if attributes, so long as all of the enable_if
conditions on a given candidate were true. So, two functions with
identical signatures (one with enable_if attributes, the other without),
would be considered equally good overloads. If we were calling the
function instead of taking its address, then the function with enable_if
attributes would be preferred.
This patch makes us prefer the candidate with enable_if regardless of if
we're calling or taking the address of an overloaded function.
Nico Weber [Thu, 15 Oct 2015 16:03:01 +0000 (16:03 +0000)]
clang-format/java: Break after annotations on fields in Chromium style.
Chromium follows the Android style guide for Java code, and that doesn't make
the distinction between fields and non-fields that the Google Java style guide
makes:
NAKAMURA Takumi [Thu, 15 Oct 2015 13:51:13 +0000 (13:51 +0000)]
Tweak to make clang/test/Driver/ps4-linker-win.c less sinsitive of DLL path.
- On mingw-w64, libstdc++-6.dll is used for clang.exe. The DLL might not be in Windows' system directory.
- With --enable-shared, DLLs might be in ${CMAKE_BINARY_DIR}/bin.
I understand this test confirms that appropriate name of executable can be found on %PATH%.
Therefore I added "Output\\" before each expression.
FIXME: The output directory %T is hardcoded like "Output\\ps4-ld.exe".
Teresa Johnson [Thu, 15 Oct 2015 13:41:51 +0000 (13:41 +0000)]
Revert "Clang support for -flto=thin." (bot failures)
Rolling this back for now since there are a couple of bot failures on
the new tests I added, and I won't have a chance to look at them in detail
until later this afternoon. I think the new tests need some restrictions on
having the gold plugin available.
There was a minor problem with a test. Sorry for the noise yesterday.
This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.
A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!
Sean Silva [Wed, 14 Oct 2015 06:45:07 +0000 (06:45 +0000)]
Revert-to-green r250262 (PS4 toolchain patch)
It is breaking llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
e.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/1362
Alexey Bataev [Wed, 14 Oct 2015 04:05:42 +0000 (04:05 +0000)]
[MSVC] Fix for http://llvm.org/PR24132: __declspec(property): double invocations of foo() when compiling foo()->propertyName
Removes extra codegen for base expression of MS property call
Differential Revision: http://reviews.llvm.org/D13375
I took care of the build problem in the commit 250252.
Resubmitting the patch.
This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.
A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!
This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.
A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!
Chris Bieneman [Tue, 13 Oct 2015 23:03:54 +0000 (23:03 +0000)]
[CMake]Getting rid of references to LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION in favor of LLVM_VERSION_MAJOR and LLVM_VERSION_MINOR.
LLVM_SUBMIT_VERSION and LLVM_SUBMIT_SUBVERSION are commonly used variable names in the autoconf build system. They seem to have leeched into clang's CMake in a few places, and should just be replaced by the LLVM_VERSION_* variables where appropriate.
Benjamin Kramer [Tue, 13 Oct 2015 15:19:32 +0000 (15:19 +0000)]
[Driver] Use the parent_path of the clang executable as the default InstalledDir
This is what most people want anyways. Clang -cc1's main() will override
this but for other tools this is the most sensible default and avoids
some work.
Richard Smith [Tue, 13 Oct 2015 00:39:40 +0000 (00:39 +0000)]
[modules] Allow the error on importing a C++ module within an extern "C"
context (but otherwise at the top level) to be disabled, to support use of C++
standard library implementations that (legitimately) mark their <blah.h>
headers as being C++ headers from C libraries that wrap things in 'extern "C"'
a bit too enthusiastically.
Richard Smith [Tue, 13 Oct 2015 00:23:25 +0000 (00:23 +0000)]
[modules] Fix merging of __va_list_tag's implicit special member functions.
We model predefined declarations as not being from AST files, but in most ways
they act as if they come from some implicit prebuilt module file imported
before all others. Therefore, if we see an update to the predefined 'struct
__va_list_tag' declaration (and we've already loaded any modules), it needs a
corresponding update record, even though it didn't technically come from an AST
file.
Evgeniy Stepanov [Mon, 12 Oct 2015 23:50:19 +0000 (23:50 +0000)]
[safestack] Driver link test for safestack on android.
Safestack runtime should never be linked on Android targets because
it is implemented directly in libc. This is already the case, but
mostly by chance (collectSanitizerRuntimes would only link shared
sanitizer runtimes, and safestack has only a static one). Protect
this behavior with a test.
Add support for the `-fdebug-prefix-map=` option as in GCC. The syntax is
`-fdebug-prefix-map=OLD=NEW`. When compiling files from a path beginning with
OLD, change the debug info to indicate the path as start with NEW. This is
particularly helpful if you are preprocessing in one path and compiling in
another (e.g. for a build cluster with distcc).
Note that the linearity of the implementation is not as terrible as it may seem.
This is normally done once per file with an expectation that the map will be
small (1-2) entries, making this roughly linear in the number of input paths.
Chris Bieneman [Mon, 12 Oct 2015 16:34:23 +0000 (16:34 +0000)]
[CMake] Bug 14109 - CMake build for compiler-rt should use just-built clang
Summary:
Many small improvements to LLVM_BUILD_EXTERNAL_COMPILER_RT.
* Works correctly with Ninja by working around CMake Bug 14771 (https://cmake.org/Bug/view.php?id=14771)
* Has install-compiler-rt target, and installs as part of the default install target
* Sets the install paths properly so that it matches the non-standalone build
* Only generate the test targets if(LLVM_INCLUDE_TESTS)
Benjamin Kramer [Mon, 12 Oct 2015 16:16:39 +0000 (16:16 +0000)]
[VFS] Let the user decide if they want path normalization.
This is a more principled version of what I did earlier. Path
normalization is generally a good thing, but may break users in strange
environments, e. g. using lots of symlinks. Let the user choose and
default it to on.
This also changes adding a duplicated file into returning an error if
the file contents are different instead of an assertion failure.
Alexey Bataev [Mon, 12 Oct 2015 06:59:48 +0000 (06:59 +0000)]
[ATTR] Automatic line feed after pragma-like attribute.
Automatically insert line feed after pretty printing of all pragma-like attributes + fix printing of pragma-like pragmas on declarations.
Differential Revision: http://reviews.llvm.org/D13546
C allows for some implicit conversions that C++ does not, e.g. void* ->
char*. This patch teaches clang that these conversions are okay when
dealing with overloads in C.
NAKAMURA Takumi [Sat, 10 Oct 2015 02:37:30 +0000 (02:37 +0000)]
[CMake] Always generate and install cmake config files on CMake>=3.0.
Currently, cmake config files are only generated and installed when CLANG_BUILD_STANDALONE set, which means config file will not be generated or installed when clang is built with llvm. This change removes that restriction.
Douglas Gregor [Fri, 9 Oct 2015 20:36:17 +0000 (20:36 +0000)]
Fix inference of _Nullable for weak Objective-C properties.
The inference of _Nullable for weak Objective-C properties was broken
in several ways:
* It was back-patching the type information very late in the process
of checking the attributes for an Objective-C property, which is
just wrong.
* It was using ad hoc checks to try to suppress the warning about
missing nullability specifiers (-Wnullability-completeness), which
didn't actual work in all cases (rdar://problem/22985457)
* It was inferring _Nullable even outside of assumes-nonnull regions,
which is wrong.
Putting the inference of _Nullable for weak Objective-C properties in
the same place as all of the other inference logic fixes all of these
ills.
The goal of wanting this to avoid munging the feature list is so
that it can be used for various targets as a way of both adding
and verifying the features that are going to be output into the
IR.