This is a follow-up to an IRC conversation with Richard last night; __assume
does not evaluate its argument, and so the argument should not contribute to
whether (__assume(e), constant) can be used where a constant is required.
llvm-svn: 213267
In MS-compatibility mode, we support the __assume builtin. The __assume builtin
does not evaluate its arguments, and we should issue a warning if __assume is
provided with an argument with side effects (because these effects will be
discarded).
This is similar in spirit to the warnings issued by other compilers (Intel
Diagnostic 2261, MS Compiler Warning C4557).
llvm-svn: 213266
Summary:
I'm planning on upstreaming some test cases for the inline assembly
usage in the Mozilla code base. A lot of these test cases test the
recent fixes to this code.
Reviewers: rnk
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4508
llvm-svn: 213255
Memory barrier __builtin_arm_[dmb, dsb, isb] intrinsics are required to
implement their corresponding ACLE and MSVC intrinsics.
This patch ports ARM dmb, dsb, isb intrinsic to AArch64.
Requires LLVM r213247.
Differential Revision: http://reviews.llvm.org/D4521
llvm-svn: 213250
Summary:
With this patch (and a corresponding LLVM patch), assembling an empty file with
GCC and Clang -fintegrated-as produce near identical objects. The remaining
differences are:
* GCC/GAS produce objects have a .pdr section
* GCC/GAS produce objects have a .gnu.attributes section
Other differences are insignificant such as precise file offsets and the order
of strings in the string table.
Differential Revision: http://reviews.llvm.org/D4531
llvm-svn: 213241
-- a constructor list initialization that unpacked an initializer list into
constructor arguments and
-- a list initialization that created as std::initializer_list and passed it
as the first argument to a constructor
in the AST. Use this flag while instantiating templates to provide the right
semantics for the resulting initialization.
llvm-svn: 213224
When plugins are used the Multiplex(AST)Consumer is employed to dispatch
to both the plugin ASTConsumers and the IRGen ASTConsumer. It wasn't
dispatching a critical call for debug info, resulting in plugin users
having a negative debugging experience.
While I'm here, forward a bunch of other missing calls through the
consumer that seem like they should be there.
To test this, use the example plugin (requires plugins and examples) and
split the test case up so that the plugin testing can be done under that
requirement while the non-plugin testing will execute even in builds
that don't include plugin support or examples.
llvm-svn: 213213
By having the two variables 'a' and 'b' in this test in a namespace, the
type was required to be complete before any debug info was ever emitted
(the entire namespace is parsed before the variables were emitted), this
meant that the codepath in which a declaration is emitted, then later on
the type is required to be complete and the debug info must be upgraded
to a definition was not used.
Moving the variables outside a namespace fixes this test coverage bug.
(interestingly, code coverage didn't help here -
HandleTagDeclRequireDefinition is fully covered because it's called even
in cases where the type hasn't been emitted for debug info at all
(further down in CGDebugInfo this no-ops) - so CC wouldn't've helped
catch this test coverage problem)
llvm-svn: 213211
Clang supports __assume, at least at the semantic level, when MS extensions are
enabled. Unfortunately, trying to actually compile code using __assume would
result in this error:
error: cannot compile this builtin function yet
__assume is an optimizer hint, and can be ignored at the IR level. Until LLVM
supports assumptions at the IR level, a noop lowering is valid, and that is
what is done here.
llvm-svn: 213206
constructor (and pass it an implicitly-generated std::initializer_list object),
be sure to mark the resulting construction as list-initialization. This fixes
an assert in template instantiation where we previously thought we'd got direct
non-list initialization without any parentheses.
llvm-svn: 213201
however certain sloppy Makefiles pass -z options directly to
the compiler. This patch enables clang to recognize these
options (because -z is not used by clang itself).
llvm-svn: 213198
With this change the memory of buffer in NestedNameSpecifierLocBuilder
is allocated in one place. It also prevents from allocation of tiny blocks.
llvm-svn: 213178
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.
Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.
Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.
llvm-svn: 213171
to be applied to class or protocols. This will direct IRGen
for Objective-C metadata to use the new name in various places
where class and protocol names are needed.
rdar:// 17631257
llvm-svn: 213167
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.
This reverts commit r213150.
Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."
This reverts commit r213148.
Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"
This reverts commit r213146.
llvm-svn: 213159
Summary:
As a result of this patch, assembling an empty file with GCC and Clang (using
GAS as the assembler) now produces identical objects.
-mfp32/-mfpxx/-mfp64 now form a trinity of options. -mfpxx is the default
when the triple vendor is 'img' or 'mti', the ABI is O32, and the CPU is
between mips2 and mips32r2/mips64r2 (inclusive).
-mno-shared is always given to the assembler to match the effect of
-mabicalls (currently unimplemented but Clang acts as if it is given).
Similarly, -call_nonpic is always given to match the effect of -mplt (also
unimplemented and acts as if given) except when the ABI is 64 in which case
-mplt has no effect so -KPIC is given instead.
-mhard-float/-msoft-float are now passed on.
-modd-spreg/-mno-odd-spreg are now passed on.
-mno-mips16 is correctly passed on. The assembler option is -no-mips16 not
-mno-mips16
Differential Revision: http://reviews.llvm.org/D4515
llvm-svn: 213138
We would correctly insert sufficiently aligned padding between vbases
when our leading base was empty, however we would neglect to increase
the required alignment of the most derived class.
This fixes PR20315.
llvm-svn: 213123
No functionality changed, just some cleanups:
- Switch some loops to range-based for.
- Name some iterators with a more creative name than "I".
- Reduce dependence on auto. Does RD->bases() give you a list of
CXXBaseSpecifiers or CXXRecordDecls? It's more clear to just say which
upfront.
llvm-svn: 213121
Recognize additional cases, when '::' is mistyped as ':'.
This is a fix to RP18587 - colons have too much protection in member-declarations
Review is tracked by http://reviews.llvm.org/D3653.
This is an attempt to recommit the fix, initially committed as r212957 but then
reverted in r212965 as it broke self-build. In the updated patch ParseDirectDeclarator
turns on colon protection in for context as well.
llvm-svn: 213120
This restores the original behaviour of -fmsc-version. The older option
remains as a mechanism for specifying the basic version information. A
secondary option, -fms-compatibility-version permits the user to specify an
extended version to the driver.
The new version takes the value as a dot-separated value rather than the
major * 100 + minor format that -fmsc-version format. This makes it easier to
specify the value as well as a more flexible manner for specifying the value.
Specifying both values is considered an error.
The older parameter is left solely as a driver option, which is normalised into
the newer parameter. This allows us to retain a single code path in the
compiler itself whilst preserving the semantics of the old parameter as well as
avoid having to determine which of two formats are being used by the invocation.
The test changes are due to the fact that the compiler no longer supports the
old option, and is a direct conversion to the new option.
llvm-svn: 213119
Clang uses a diagnostic handler to grab diagnostic messages so it can print them
with the line of source code they refer to. This patch extends this to handle
diagnostic warnings that were added to llvm to produce a warning when
loop vectorization is explicitly specified (using a pragma clang loop directive)
but fails.
Reviewed by: Aaron Ballman
llvm-svn: 213112
This fixes compilation errors about incomplete types used with WebKit's
RefPtr template. Simply calling an out of line constructor should not
instantiate all inline and defaulted virtual methods.
Tested by building and testing several big piles of code on Linux.
Reviewers: rsmith
Differential Revision: http://reviews.llvm.org/D4429
llvm-svn: 213109
Summary:
This implements the -arch flag for both x86 and x86-64 by letting
them affect the default target features we pass to cc1. -m machine
flags will override the features set by -arch.
Reviewers: hansw
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4519
llvm-svn: 213083
Now, this can be properly formatted:
static_cast<A< //
B> *>( //
);
Before, clang-format could end up, not formatting the code at all.
llvm-svn: 213055
redeclaration chains when pulling in a declaration. We need the redecl chain
unless we know some other declaration will trigger it to be pulled in; that
happens if our originally-canonical declaration had all the knowledge that
we have (and isn't us).
llvm-svn: 213043
Summary:
Without this, we would not consume the closing brace which would cause
the parser to start consuming C++ and bad things would happen.
Reviewers: majnemer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4505
llvm-svn: 213032
While we previously supported __uuidof applied to a template
specialization, we would only find the uuid attribute if it was applied
to the template argument. We would erroneously ignore the uuid
attribute on the specialization itself.
This is required to parse Windows Runtime C++ Template Library headers.
llvm-svn: 213016
Switch some things to use range-based for loops.
Change CXXUuidofExpr::GetUuidAttrOfType's return type to be const.
No functionality changed.
llvm-svn: 213009
Prospectively revert to get one of the many build configurations back working
(presumably the side-by-side+modular CMake config).
This reverts commit r212997.
llvm-svn: 213008
Otherwise, multiple errors such as having unknown identifiers for two
arguments won't be diagnosed properly (e.g. only the first one would
have a diagnostic message if typo correction fails even though both
would be diagnosed if typo correction suggests a replacement).
llvm-svn: 213003
The attempt in r212980 was broken because we might not fail if
LLVM_ON_UNIX is enabled for cross compiling to Windows, and it didn't
consider mingw either.
llvm-svn: 212989
corresponding AST context function, only restricted to basic integer
types. Use this to ensure getUIntPtrType() gives types consistent with
getIntPtrType(). Fix NVPTX backend to give signed intptr_t.
llvm-svn: 212982
array prvalue), treat that as a direct binding. Only the class prvalue case
needs to be excluded here; the rest are extensions anyway, so we can treat them
as we would in C++11.
llvm-svn: 212978
Just because we can open a directory named "COcoa.framework" doesn't
mean we should provide a "COcoa" module on a case-insensitive filesystem.
llvm-svn: 212975
We don't have a style guide for diagnostic messages, but convention strongly
favours the forms:
'attribute is not supported', 'unsupported attribute'
We generally avoid:
'attribute is unsupported', 'non-supported attribute'
llvm-svn: 212972
This reverts commit r212957. It broke the self-host on code like this
from LLVM's option library:
for (auto Arg: filtered(Id0, Id1, Id2))
llvm-svn: 212965
Use -Winvalid-command-line-argument here to align with existing gcc opt
diagnostics. Meanwhile -Wunused-command-line-argument is for flags that we
support but were, say, fed into the wrong invocation.
Also tweak wording to make sense with -Werror.
llvm-svn: 212964
Recognize additional cases, when '::' is mistyped as ':'.
This is a fix to RP18587 - colons have too much protection in member-declarations.
Differential Revision: http://reviews.llvm.org/D3653
llvm-svn: 212957
An array showing up in an inline assembly input is accepted in ICC and
GCC 4.8
This fixes PR20201.
Differential Revision: http://reviews.llvm.org/D4382
llvm-svn: 212954
This patch implements __builtin_arm_nop intrinsic for AArch32 and AArch64,
which generates hint 0x0, the alias of NOP instruction.
This intrinsic is necessary to implement ACLE __nop intrinsic.
Differential Revision: http://reviews.llvm.org/D4495
llvm-svn: 212947
Freestanding overloads are represented as FunctionDecls in the AST, make
the matcher also match them.
Differential Revision: http://reviews.llvm.org/D4493
llvm-svn: 212940
a function pointer is neither better nor worse than binding a function lvalue
to a function rvalue reference. Don't get confused and think that both bindings
are binding to a function lvalue (which would make the lvalue form win); the
const reference is binding to an rvalue.
The "real" bug in PR20218 is still present: we're getting the wrong answer from
template argument deduction, and that's what leads us to this weird overload
set.
llvm-svn: 212916
Previously, we would have a private backing variable and an internal
alias pointing at it.
However, -fdata-sections only fires if a global variable has non-private
linkage. This means that an unreferenced vftable wouldn't get
discarded, bloating the object file.
Instead, stick the backing variable in a comdat even if the alias has
internal linkage. This will allow the linker to drop the vftable if it
is unused.
llvm-svn: 212901
This adds the ARM ACLE hint intrinsic wrappers to arm_acle.h. These need to be
protected with a !defined(_MSC_VER) since MSVC (and thus clang in compatibility
mode) provide these wrappers as proper builtin intrinsics.
llvm-svn: 212891
Currently ASan instrumentation pass creates a string with global name
for each instrumented global (to include global names in the error report). Global
name is already mangled at this point, and we may not be able to demangle it
at runtime (e.g. there is no __cxa_demangle on Android).
Instead, create a string with fully qualified global name in Clang, and pass it
to ASan instrumentation pass in llvm.asan.globals metadata. If there is no metadata
for some global, ASan will use the original algorithm.
This fixes https://code.google.com/p/address-sanitizer/issues/detail?id=264.
llvm-svn: 212872
Ideally, we would use the /arch cl.exe flag for this stuff.
Unfortunately, MSVC supports only 5 /arch flag values, which isn't
nearly enough to cover all the CPU features that LLVM cares about. At
the very least, we need to know about SSE3 and SSE4.1 in addition to
SSE, SSE2, AVX, and AVX2.
In the future we should add the relevant /arch mappings in addition to
these gcc-style -m flags.
llvm-svn: 212869
MSVC accepts __noop without any trailing parens and treats it like a
literal zero. We don't treat __noop as an integer literal, but now at
least we can parse a naked __noop expression.
Reviewers: rsmith
Differential Revision: http://reviews.llvm.org/D4476
llvm-svn: 212860
OS X TLS has all accesses going through the thread-wrapper function and
gives the backing thread-local variable internal linkage. This means
that thread-wrappers must have WeakAnyLinkage so that references to the
internal thread-local variables do not get propagated to other code.
It also means that translation units which do not provide a definition
for the thread-local variable cannot attempt to emit a thread-wrapper
because the thread wrapper will attempt to reference the backing
variable.
Differential Revision: http://reviews.llvm.org/D4109
llvm-svn: 212841
We now have an LLVM-level nonnull attribute that can be applied to function
parameters, and we emit it for reference types (as of r209723), but did not
emit it when an __attribute__((nonnull)) was provided. Now we will.
llvm-svn: 212835
Summary:
Added some tests to see if the new warning would be silenced with a flag.
Patch by Arthur Marble <arthur@info9.net> in the context of Debian Google Summer of code 2014.
Reviewers: sylvestre.ledru
Reviewed By: sylvestre.ledru
Differential Revision: http://reviews.llvm.org/D4475
llvm-svn: 212833
- Plugins don't need to export _ZN4llvm8Registry*.
- Win32.DLL cannot merge common symbols among DLLs. Static members in llvm::Registry should be instantiated in a parent.
llvm-svn: 212821
-mx32 flag setup target environment to GNUX32 and can be used for
other 32/64-bit triplets (i386-unknown-linux, x86_64-unknown-linux) to
turn on x32 mode. Compatible with GCC -mx32 flag.
Differential Revision: http://reviews.llvm.org/D4470
llvm-svn: 212817
Returns a warning when using an unknown optimization flag.
This patch includes -finline-limit as one of those ignored flags.
More options will be moved in this group
Patch by Arthur Marble <arthur@info9.net> in the context of
Debian Google Summer of code 2014.
Reviewers: rnk, Sylvestre
llvm-svn: 212805
into their container; we won't find them there. These things are already being
merged when they're added to their primary template's folding set, so this
merging is redundant (and causes us to reject-valid because we think we've
found an odr violation).
llvm-svn: 212788