Sylvestre Ledru [Tue, 18 Feb 2014 17:45:06 +0000 (17:45 +0000)]
In some cases (for example, the Firefox build system), the CLANG_CXX variable is defined but empty.
Extend the test (like it is done in scan-build) to check also if the variable
is empty or not.
Aaron Ballman [Tue, 18 Feb 2014 17:36:50 +0000 (17:36 +0000)]
DeLesley Hutchins (who wrote the original thread-safety attribute functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used.
The following attributes have been (silently) deprecated, with their replacements listed:
Richard Smith [Tue, 18 Feb 2014 03:51:47 +0000 (03:51 +0000)]
PR18876: The special-case rule that ignores the destruction of a top-level
temporary in a decltype expression only applies if that temporary was created
by a function call, not by a function-style cast or other flavour of
expression.
Bob Wilson [Mon, 17 Feb 2014 19:21:09 +0000 (19:21 +0000)]
Change PGO instrumentation to compute counts in a separate AST traversal.
Previously, we made one traversal of the AST prior to codegen to assign
counters to the ASTs and then propagated the count values during codegen. This
patch now adds a separate AST traversal prior to codegen for the
-fprofile-instr-use option to propagate the count values. The counts are then
saved in a map from which they can be retrieved during codegen.
This new approach has several advantages:
1. It gets rid of a lot of extra PGO-related code that had previously been
added to codegen.
2. It fixes a serious bug. My original implementation (which was mailed to the
list but never committed) used 3 counters for every loop. Justin improved it to
move 2 of those counters into the less-frequently executed breaks and continues,
but that turned out to produce wrong count values in some cases. The solution
requires visiting a loop body before the condition so that the count for the
condition properly includes the break and continue counts. Changing codegen to
visit a loop body first would be a fairly invasive change, but with a separate
AST traversal, it is easy to control the order of traversal. I've added a
testcase (provided by Justin) to make sure this works correctly.
3. It improves the instrumentation overhead, reducing the number of counters for
a loop from 3 to 1. We no longer need dedicated counters for breaks and
continues, since we can just use the propagated count values when visiting
breaks and continues.
To make this work, I needed to make a change to the way we count case
statements, going back to my original approach of not including the fall-through
in the counter values. This was necessary because there isn't always an AST node
that can be used to record the fall-through count. Now case statements are
handled the same as default statements, with the fall-through paths branching
over the counter increments. While I was at it, I also went back to using this
approach for do-loops -- omitting the fall-through count into the loop body
simplifies some of the calculations and make them behave the same as other
loops. Whenever we start using this instrumentation for coverage, we'll need
to add the fall-through counts into the counter values.
Anton Yartsev [Mon, 17 Feb 2014 18:25:34 +0000 (18:25 +0000)]
[analyzer] Improved checker naming in CFG dump.
This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with the new ones obtained via getCheckName().getName().
Aaron Ballman [Mon, 17 Feb 2014 18:23:02 +0000 (18:23 +0000)]
Forcing it to be an error when there is no Documentation list specified for an attribute. This is a bit of a (harmless) hack, but the FIXME explains why and when this hack can be removed. It's a justified hack because this prevents attribute authors from forgetting to add documentation when they add a new attribute.
Aaron Ballman [Mon, 17 Feb 2014 15:27:10 +0000 (15:27 +0000)]
Implements a declarative approach to documenting individual attributes in Clang via a Documentation tablegen class. Also updates the internals manual with information about how to use this new, required, documentation feature.
This patch adds some very, very sparse initial documentation for some attributes. Additional effort from attribute authors is greatly appreciated.
Daniel Jasper [Mon, 17 Feb 2014 07:57:46 +0000 (07:57 +0000)]
clang-format: Don't wrap "const" etc. of function declarations.
Generally people seem to prefer wrapping the first function parameter
over wrapping the trailing tokens "const", "override" and "final". This
does not extend to function-like annotations and probably not to other
non-standard annotations.
Manman Ren [Sat, 15 Feb 2014 01:29:02 +0000 (01:29 +0000)]
PGO: fix a bug in parsing pgo data.
When a function has a single counter, we will offset the pointer by 1 when
parsing the next function. If a function has multiple counters, we are
okay after skipping rest of the counters.
David Majnemer [Sat, 15 Feb 2014 01:21:20 +0000 (01:21 +0000)]
MS ABI: Fix some layout tests
Some lines intended to be used for testing x86_64 ABI compatibility were
not firing because lines were annotated with the wrong FileCheck prefix:
X64 vs 64
David Majnemer [Sat, 15 Feb 2014 01:09:56 +0000 (01:09 +0000)]
MS ABI: Fix some layout tests
Some lines intended to be used for testing x86_64 ABI compatibility were
not firing because lines were annotated with the wrong FileCheck prefix:
X64 vs C64
[Objective-C Sema]. Warn when an indirectly overridden property
mismatches the one declared in current class; in addition to
those that are directly overridden.
// rdar://15967517
[IRGen]. Fixes a crash in using Objective-C array
properties by fixing shouldBindAsLValue to accept arrays
(like record types) because we always manipulate
them in memory. Patch suggested by John MaCall.
// rdar://15610943
Kaelyn Uhrain [Thu, 13 Feb 2014 20:14:07 +0000 (20:14 +0000)]
Enable correcting a member declaration where the type is class template,
and the class name is shadowed by another member. Recovery still needs
to be figured out, which is non-trivial since the parser has already gone
down a much different path than if it had recognized the class template
as type instead of seeing the member that shadowed the class template.
Jordan Rose [Thu, 13 Feb 2014 18:12:30 +0000 (18:12 +0000)]
[examples] Add tablegen'd ClangCommentCommandList as a dependency for plugins.
Also, remove library dependencies for the sample analyzer-plugin. The only
library changes that would require a rebuild should be in headers, which
should already implicitly be marked as dependencies.
Daniel Sanders [Thu, 13 Feb 2014 14:44:26 +0000 (14:44 +0000)]
Re-commit: Demote EmitRawText call in AsmPrinter::EmitInlineAsm() and remove hasRawTextSupport() call
Summary:
AsmPrinter::EmitInlineAsm() will no longer use the EmitRawText() call for
targets with mature MC support. Such targets will always parse the inline
assembly (even when emitting assembly). Targets without mature MC support
continue to use EmitRawText() for assembly output.
The hasRawTextSupport() check in AsmPrinter::EmitInlineAsm() has been replaced
with MCAsmInfo::UseIntegratedAs which when true, causes the integrated assembler
to parse inline assembly (even when emitting assembly output). UseIntegratedAs
is set to true for targets that consider any failure to parse valid assembly
to be a bug. Target specific subclasses generally enable the integrated
assembler in their constructor. The default value can be overridden with
-no-integrated-as.
All tests that rely on inline assembly supporting invalid assembly (for example,
those that use mnemonics such as 'foo' or 'hello world') have been updated to
disable the integrated assembler.
Changes since review (and last commit attempt):
- Fixed test failures that were missed due to configuration of local build.
(fixes crash.ll and a couple others).
- Fixed tests that happened to pass because the local build was on X86
(should fix 2007-12-17-InvokeAsm.ll)
- mature-mc-support.ll's should no longer require all targets to be compiled.
(should fix ARM and PPC buildbots)
- Object output (-filetype=obj and similar) now forces the integrated assembler
to be enabled regardless of default setting or -no-integrated-as.
(should fix SystemZ buildbots)
Daniel Jasper [Thu, 13 Feb 2014 14:24:14 +0000 (14:24 +0000)]
Remove assert added in r201249.
This triggers on one of our internal tests.
Dmitri:
I do not understand this part of the codebase well enough to locate the
underlying cause easily. If the correct fix is not obvious, I can try to
debug the problem further or try to come up with reduced test case.
Tim Northover [Thu, 13 Feb 2014 10:44:17 +0000 (10:44 +0000)]
ARM & AArch64 NEON: share the vabs implementation.
This changes ARM to use @llvm.fabs for floating-point vabs. Patterns
already existed in the backend, and it might help mid-end phases since
it's more likely to be understood than @llvm.arm.neon.vabs.
Renato Golin [Thu, 13 Feb 2014 10:01:16 +0000 (10:01 +0000)]
Add EXPERIMENTAL --rtlib=compiler-rt to GNU Clang
This commit is not strictly correct nor accounts for all uses (shared
objects, for example), but it allows one to test the compiler-rt library
on GNU targets.
Using this patch to run the test-suite has already shown me problems
on ARM. Since this is a Darwin-only flag, nobody is using it, so it
shouldn't be a problem.
I will need extension to deal with the shared cases, but since we're
not compiling libclang_rt.so, that's not yet applicable. Many other
problems will have to be fixed first in compiler-rt (such as removing
the 'arch' name from it and making it trully multi-arch, moving it to
the default lib directory, make both .a and .so variants, etc).
Yunzhong Gao [Thu, 13 Feb 2014 02:45:10 +0000 (02:45 +0000)]
Fixing a compiler assertion with zero-width bit-fields in packed structs.
According to the GNU docs, zero-sized bitfields should not be affected by the
packed attribute.
John McCall [Thu, 13 Feb 2014 00:50:08 +0000 (00:50 +0000)]
ms_struct layout replaces platform-specific behavior like
useBitFieldTypeAlignment() and appears to ignore the special
bit-packing semantics of __attribute__((packed)).
Reid Kleckner [Wed, 12 Feb 2014 23:50:26 +0000 (23:50 +0000)]
MS ABI: Implement #pragma vtordisp() and clang-cl /vdN
These features are new in VS 2013 and are necessary in order to layout
std::ostream correctly. Currently we have an ABI incompatibility when
self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper
in gtest.
This change adds another implicit attribute, MSVtorDispAttr, because
implicit attributes are currently the best way to make sure the
information stays on class templates through instantiation.
Dmitri Gribenko [Wed, 12 Feb 2014 19:12:37 +0000 (19:12 +0000)]
libclang: report error code for bad PCH files
This commit improves libclang to report the error condition when
CXTranslationUnit can not be created because of a stale PCH file. This allows
the caller, for example, to rebuild the PCH file and retry the request.
There two are APIs in libclang that return a CXTranslationUnit and don't
support reporting detailed errors (the only error condition is a NULL result).
For these APIs, a second, superior, version is introduced --
clang_createTranslationUnit2 and clang_parseTranslationUnit2. These functions
return a CXTranslationUnit indirectly and also return an error code. Old
functions are still supported and are nothing more than convenience wrappers
that ignore extended error codes.
As a cleanup, this commit also categorizes some libclang errors in the
functions I had to modify anyway.
Adrian Prantl [Wed, 12 Feb 2014 18:24:04 +0000 (18:24 +0000)]
Revert "Remove bad debug info test."
This reverts commit r201183.
The test, albeit undocumented and badly written is still testing something
useful. It will be updated in a subsequent commit.