Richard Smith [Mon, 17 Aug 2015 20:24:17 +0000 (20:24 +0000)]
[modules] When parsing the base specifiers of a parse-merged class, the current
context is the class itself but lookups should be performed starting with the
lookup parent of the class (class and base members don't shadow types from the
surrounding context because they have not been declared yet).
Summary:
If a module was unavailable (either a missing requirement on the module
being imported, or a missing file anywhere in the top-level module (and
not dominated by an unsatisfied `requires`)), we would silently treat
inclusions as textual. This would cause all manner of crazy and
confusing errors (and would also silently "work" sometimes, making the
problem difficult to track down).
I'm really not a fan of the `M->isAvailable(getLangOpts(), getTargetInfo(),
Requirement, MissingHeader)` function; it seems to do too many things at
once, but for now I've done things in a sort of awkward way.
The changes to test/Modules/Inputs/declare-use/module.map
were necessitated because the thing that was meant to be tested there
(introduced in r197805) was predicated on silently falling back to textual
inclusion, which we no longer do.
The changes to test/Modules/Inputs/macro-reexport/module.modulemap
are just an overlooked missing header that seems to have been missing since
this code was committed (r213922), which is now caught.
[clang-tidy] Make NumOccurrenceFlag for SourcePaths configurable.
Added an additional ctor that takes a NumOccurrenceFlag parameter for the
SourcePaths option. This frees applications from always having to pass at least
one source file, e.g., -list-checks.
Richard Smith [Mon, 17 Aug 2015 07:13:32 +0000 (07:13 +0000)]
[modules] When explicitly building a module file, don't include timestamps in
the produced pcm file for stable file creation across distributed build
systems.
Anna Zaks [Fri, 14 Aug 2015 20:22:22 +0000 (20:22 +0000)]
[analyzer] Add checkers for OS X / iOS localizability issues
Add checkers that detect code-level localizability issues for OS X / iOS:
- A path sensitive checker that warns about uses of non-localized
NSStrings passed to UI methods expecting localized strings.
- A syntax checker that warns against not including a comment in
NSLocalizedString macros.
A patch by Kulpreet Chilana!
(This is the second attempt with the compilation issue on Windows and
the random test failures resolved.)
Martell Malone [Fri, 14 Aug 2015 18:00:09 +0000 (18:00 +0000)]
Windows ARM: ignore calling conventions as described on MSDN
Summary:
MSDN says that fastcall, stdcall, thiscall, and vectorcall are all
accepted but ignored on ARM and X64.
https://msdn.microsoft.com/en-us/library/984x0h58.aspx
MSDN also says cdecl is also accepted and typically ignored
This patch brings ARM in line with how we ignore them for X64
Alexey Bataev [Fri, 14 Aug 2015 12:25:37 +0000 (12:25 +0000)]
[OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.
blender uses statements expression in condition of the loop under control of the '#pragma omp parallel for'. This condition is used several times in different expressions required for codegen of the loop directive. If there are some variables defined in statement expression, it fires an assert during codegen because of redefinition of the same variables.
We have to rebuild several expression to be sure that all variables are unique.
Manuel Klimek [Fri, 14 Aug 2015 09:55:36 +0000 (09:55 +0000)]
Add structed way to express command line options in the compilation database.
Currently, arguments are passed via the string attribute 'command',
assuming a shell-escaped / quoted command line to extract the original
arguments. This works well enough on Unix systems, but turns out to be
problematic for Windows tools to generate.
This CL adds a new attribute 'arguments', an array of strings, which
specifies the exact command line arguments. If 'arguments' is available
in the compilation database, it is preferred to 'commands'.
Currently there is no plan to retire 'commands': there are enough
different use cases where users want to create their own mechanism for
creating compilation databases, that it doesn't make sense to force them
all to implement shell command line parsing.
Richard Smith [Fri, 14 Aug 2015 05:02:58 +0000 (05:02 +0000)]
[modules] Add an experimental -cc1 feature to embed the contents of an input
file in the .pcm files. This allows a smaller set of files to be sent to a
remote build worker when building with explicit modules (for instance, module
map files need not be sent along with the corresponding precompiled modules).
This doesn't actually make the embedded files visible to header search, so
it's not useful as a packaging format for public header files.
David Blaikie [Fri, 14 Aug 2015 01:26:19 +0000 (01:26 +0000)]
unique_ptrify ConsumedBlockInfo analysis to make it move assignable
ConsumedBlockInfo objects were move assigned, but only in a state where
the dtor was a no-op anyway. Subtle and easily could've happened in ways
that wouldn't've been safe - so this change makes it safe no matter what
state the ConsumedBlockInfo object is in.
David Blaikie [Thu, 13 Aug 2015 23:53:09 +0000 (23:53 +0000)]
Wdeprecated: ByrefHelpers are copy constructed by the ::buildByrefHelpers helper, make sure they're safely copyable
Make the copy/move ctors protected and defaulted in the base, make the
derived classes final to avoid exposing any slicing-prone APIs.
Also, while I'm here, simplify the use of buildByrefHelpers by taking
the parameter by value instead of non-const ref. None of the callers
care aobut observing the state after the call.
David Majnemer [Thu, 13 Aug 2015 23:50:15 +0000 (23:50 +0000)]
Avoid iteration invalidation issues around MaterializedTemporaryExpr
We risk iterator invalidation issues if we use a DenseMap to hold the
backing storage for an APValue. Instead, BumpPtrAllocate them and
use APValue * as our DenseMap value.
Also, don't assume that MaterializedGlobalTemporaryMap won't regrow
between when we initially perform a lookup and later on when we actually
try to insert into it.
Richard Smith [Thu, 13 Aug 2015 23:47:44 +0000 (23:47 +0000)]
[modules] When writing a module file built with -fmodule-map-file-home-is-cwd,
via a module map found by -fmodule-map-file=, the home directory of the module
is the current working directory, even if that's a different directory on
reload.
Ivan Krasin [Thu, 13 Aug 2015 23:37:28 +0000 (23:37 +0000)]
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
David Blaikie [Thu, 13 Aug 2015 23:15:20 +0000 (23:15 +0000)]
Wdeprecated: Make Filter safely move constructible.
makeFilter returns Filters by value which seems to be only safe when the
copy doesn't occur and RVO kicks in. Make the object safely movable to
support this more reliably.
David Blaikie [Thu, 13 Aug 2015 22:58:37 +0000 (22:58 +0000)]
Wdeprecated: BugReporterVisitors are copied for cloning (BugReporterVisitorImpl), make sure such copies are safe
Make the copy/move ctors defaulted in the base class and make the
derived classes final to avoid any intermediate hierarchy slicing if
these types were further derived.
David Blaikie [Thu, 13 Aug 2015 22:50:09 +0000 (22:50 +0000)]
Wdeprecated: CollectReachableSymbolsCallback are move constructed/returned by value, so make sure they're copy/moveable
(return by value is in ExprEngine::processPointerEscapedOnBind and any
other call to the scanReachableSymbols function template used there)
Protect the special members in the base class to avoid slicing, and make
derived classes final so these special members don't accidentally become
public on an intermediate base which would open up the possibility of
slicing again.
David Blaikie [Thu, 13 Aug 2015 22:33:24 +0000 (22:33 +0000)]
Wdeprecated: RegionBindingsRef are copy constructed, make sure that's safe by removing the unnecessary user-declared copy assignment operator
The user-defined copy assignment looks like it was working around the
presence of a reference member (that probably doesn't change in the copy
assignment cases present in the program). Rather than continuing this - just
change the reference to a pointer and let all the special members be
defined implicitly.
David Blaikie [Thu, 13 Aug 2015 22:12:21 +0000 (22:12 +0000)]
Wdeprecated: Make BumpVectorContext movable
Turns out the one place that relied on the implicit copy ctor was safe
because it created an object in a state where the dtor was a no-op, but
that's more luck that good management.
Sure up the API by defining move construction and using it, which
implicitly disallows the unreliable copy operations.
David Blaikie [Thu, 13 Aug 2015 21:23:08 +0000 (21:23 +0000)]
Wdeprecated: LambdaScopeInfos are copied in TreeTransform, so make sure they're copyable.
Partly addressed by r244843, but the explicit dtor in LambdaScopeInfo
was still thwarting the implicit copy ctor. This does remove the key
function from LambdaScopeInfo unfortunately, but it seems neater than
having to explicitly default any special members LambdaScopeInfo needs.
Naomi Musgrave [Thu, 13 Aug 2015 18:35:11 +0000 (18:35 +0000)]
Fix previous commit: poison only class members, simpler tests
Summary: Poisoning applied to only class members, and before dtors for base class invoked
Implement poisoning of only class members in dtor, as opposed to also
poisoning fields inherited from base classes. Members are poisoned
only once, by the last dtor for a class. Skip poisoning if class has
no fields.
Verify emitted code for derived class with virtual destructor sanitizes
its members only once.
Removed patch file containing extraneous changes.
Yaron Keren [Thu, 13 Aug 2015 18:12:56 +0000 (18:12 +0000)]
Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return,
doing nothing but wasting run time. The call is not required any more
as the stream and its SmallString are always in sync.
Richard Smith [Thu, 13 Aug 2015 17:57:10 +0000 (17:57 +0000)]
[modules] Change the way we deal with .d output for explicitly-specified module
files: include the .pcm file itself in the .d output, rather than including its
own input files. Other forms of module file continue to be transparent for .d
output.
Arguably, the input files for the .pcm file are still inputs to the
compilation, but that's unnecessary for make-like build systems (where the
mtime of the .pcm file is sufficient) and harmful for smarter build systems
that know about module files and want to track only the local dependencies.
Reid Kleckner [Thu, 13 Aug 2015 17:56:49 +0000 (17:56 +0000)]
Turn off __has_feature(cxx_rtti) when -fno-rtti-data is present
-fno-rtti-data makes it so that vtables emitted in the current TU lack
RTTI data. This means that dynamic_cast usually fails at runtime. Users
of the existing cxx_rtti feature expect all of RTTI to work, not just
some of it.
Martell Malone [Thu, 13 Aug 2015 15:41:04 +0000 (15:41 +0000)]
Driver: Fix include directories when not using libgcc under mingw
Summary:
When we want to use mingw-w64 and clang with compiler-rt we should not
need to have libgcc installed. This fixes finding includes when libgcc
is not installed
Ivan Krasin [Thu, 13 Aug 2015 04:04:37 +0000 (04:04 +0000)]
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).
Richard Smith [Wed, 12 Aug 2015 22:25:24 +0000 (22:25 +0000)]
[modules] If loading a .pcm file would cause us to run out of source locations, attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed input...)
Naomi Musgrave [Wed, 12 Aug 2015 21:37:40 +0000 (21:37 +0000)]
Implement poisoning of only class members in dtor, as opposed to also poisoning fields inherited from base classes.
Verify emitted code for derived class with virtual destructor sanitizes its members only once.
Changed emission order for dtor callback, so only the last dtor for a class emits the sanitizing callback, while ensuring that class members are poisoned before base class destructors are invoked.
Skip poisoning of members, if class has no fields.
Removed patch file containing extraneous changes.
Summary: Poisoning applied to only class members, and before dtors for base class invoked
Richard Trieu [Wed, 12 Aug 2015 18:24:59 +0000 (18:24 +0000)]
Stop printing macro backtraces that don't help diagnostics.
When displaying the macro backtrace, ignore some of the backtraces that do not
provide extra information to the diagnostic. Typically, if the problem is
entirely contained within a macro argument, the macro expansion is often not
needed. Also take into account SourceRange's attached to the diagnostic when
selecting which backtraces to ignore. Two previous test cases have also been
updated.
Patch by Zhengkai Wu, with minor formatting fixes.
John Brawn [Wed, 12 Aug 2015 15:15:27 +0000 (15:15 +0000)]
Add test for PR24379
The fix for this is in LLVM but it depends on how clang handles the alias
attribute, so add a test to the clang tests to make sure everything works
together as expected.
Aaron Ballman [Wed, 12 Aug 2015 15:01:15 +0000 (15:01 +0000)]
The version of libxml2 required by c-index-test must be at least 2.5.3. Considering that this version was released in 2003, you might think the check a bit ridiculous. Unfortunately, GnuWin32 ships with libxml2 2.4.12, which was released in 2001.
This allows us to have GnuWin32 on the PATH on Windows without causing compilation errors.
All of the other docblocks for the CXCursor_* cursor kind enum values
include documentation that ends with a period. Add a period to the end
of the CXCursor_TypedefDecl documentation to follow this convention.
Richard Smith [Tue, 11 Aug 2015 22:00:24 +0000 (22:00 +0000)]
[modules] When instantiating the contents of an imported CXXRecordDecl, we can
emit lexical contents for a declaration for another module. Track which module
those contents came from, and ensure that we only grab the lexical contents
from a single such instantiation.