Commit Graph

1127 Commits

Author SHA1 Message Date
Reid Kleckner 3582f4370e Use noexcept instead of LLVM_NOEXCEPT now that all compilers support it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 23:39:55 +00:00
Manuel Klimek 51cb66f5f8 Delete clang-completion-mode.el.
It has been unmaintained for a while (last change was more than four
years ago), and it appears not widely used.
By now there are multiple well-maintained alternatives (emacs-ycmd,
atuo-complete-clang), and if users try to make this work they'll likely
have a bad user experience.

Reasoning and problems pointed out by Philipp Stephani.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 09:25:34 +00:00
Mehdi Amini e5f86e2485 Turn cl::values() (for enum) from a vararg function to using C++ variadic template
The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

Differential Revision: https://reviews.llvm.org/D25342

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 19:41:06 +00:00
Manuel Klimek cf8824a440 Fix warnings in clang-completion-mode.el.
- Use defvar to declare variables
- Don't use delete-backward-char, which is for interactive use only

Patch by Philipp Stephani

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282573 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 10:20:10 +00:00
Devin Coughlin bff491fabc [analyzer] SATestBuild.py: Treat '#' as comment in projectMap.csv
Treat lines in projectMap.csv that start with '#' as comments. This enables a
workflow where projects can be temporarily disabled with a comment describing
when they should be turned back on.

Differential Revision: https://reviews.llvm.org/D24709

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-19 01:36:40 +00:00
Richard Smith 8108d3c563 [docs] Order diagnostic cross-references alphabetically rather than based on
order in the .td file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 01:55:42 +00:00
Richard Smith b7ad5ad5f8 Update DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups in a deterministic order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281433 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14 01:51:10 +00:00
Reid Kleckner 238012f2b7 Fix a FIXME about MSVC 2013 in the diagnostic doc generation code
Ultimately it boiled down to adding a move constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 22:22:56 +00:00
Richard Smith ba75b718a1 Work around MSVC 2013's inability to default move special members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 20:00:02 +00:00
Richard Smith 087efca9e5 Work around a GCC 4.7-specific issue: due to implementing older rules for
implicit declarations of move operations, GCC 4.7 would find that SelectPiece
has neither a move constructor nor a copy constructor. The copy constructor was
(correctly) deleted because the class has a member of move-only type, and the
move constructor was (incorrectly, per current C++ rules) not provided because
the class has a copy-only base class (in turn because it explicitly declares a
destructor).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 18:35:34 +00:00
Richard Smith 060de1f17b Add virtual destructor (necessary due to the switch to shared_ptr).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 06:51:11 +00:00
Richard Smith 4d206e7dc2 Attempt #3 to placate MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 06:38:31 +00:00
Richard Smith 1f95189163 Attempt #2 to placate MSVC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 06:23:26 +00:00
Richard Smith 6eb4a61023 Attempt to placate MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 06:13:44 +00:00
Richard Smith 89f2f0d185 Add a mode to clang-tblgen to generate reference documentation for warning and
remark flags. For now I'm checking in a copy of the built documentation, but we
can replace this with a placeholder (as we do for the attributes reference
documentation) once we enable building this server-side.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281192 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-12 05:58:29 +00:00
Akira Hatanaka f3ab1d3197 [tablegen] Check that an optional IdentifierArgument of an attribute is
provided before trying to print it.

This fixes a segfault that occurs when function printPretty generated by
tablegen tries to print an optional argument of attribute
objc_bridge_related.

rdar://problem/28155469


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281132 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-10 03:29:43 +00:00
Nico Weber 69084593cd Add plumbing for new attribute type "Microsoft".
This is for attributes in []-delimited lists preceding a class, like e.g.
`[uuid("...")] class Foo {};`  Not used by anything yet, so no behavior change.
Part of https://reviews.llvm.org/D23895


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280575 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-03 02:55:10 +00:00
Eric Fiselier 89aa3ede8e Implement __attribute__((require_constant_initialization)) for safe static initialization.
Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280525 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 18:53:31 +00:00
Eric Fiselier f92a8d01c4 Revert r280516 since it contained accidental changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 18:43:25 +00:00
Eric Fiselier 85fb4f5d75 Implement __attribute__((require_constant_initialization)) for safe static initialization.
Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-02 18:25:29 +00:00
Chris Bieneman 7c149ef117 [Order Files] On Darwin use DTrace's oneshot probe
The oneshot probe only gets executed the first time the probe is hit in the process. For order file generation this is really all we care about.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279673 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24 22:09:46 +00:00
Vedant Kumar bd30b4ebe0 [clang-tblgen] Remove unused #include (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277885 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05 22:48:53 +00:00
Chris Bieneman 0f8c3e3eb8 Revert "[Order Files] Remove dtrace predicate"
This reverts commit r277487.

Removing the probe predicate was a red herring. It results in more symbols being placed in the final order file, but they are symbols from outside the clang image.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277492 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 18:23:56 +00:00
Chris Bieneman b0191e8f72 [Order Files] Remove dtrace predicate
Having the dtrace predicate setup to only show probes in clang filters out static initializers executed by dyld, which we do want included in the order files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 17:50:53 +00:00
Chris Bieneman 9bce81c0b5 [Order Files] Fixing an error in the perf-helper script
Dtrace probemod needs to be based on the first argument of the command, not the first argument of the args. This error was introduced a while back when I added support for skipping the driver and invoking cc1 directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 22:54:00 +00:00
Chris Bieneman c3c1ac7968 [Perf-Helper] Add logging for dtrace commands
Logging the dtrace command into the top of the dtrace log is useful when debugging why the order file generation is flaky.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277234 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 22:48:17 +00:00
Mehdi Amini 2e23251d3e [NFC] Header cleanup
Summary: Removed unused headers, replaced some headers with forward class declarations

Patch by: Eugene <claprix@yandex.ru>

Differential Revision: https://reviews.llvm.org/D20100

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275882 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 19:02:11 +00:00
Saleem Abdulrasool 848b378c98 Sema: support __declspec(dll*) on ObjC interfaces
Extend the __declspec(dll*) attribute to cover ObjC interfaces.  This was
requested by Microsoft for their ObjC support.  Cover both import and export.
This only adds the semantic analysis portion of the support, code-generation
still remains outstanding.  Add some basic initial documentation on the
attributes that were previously empty.  Tweak the previous tests to use the
relative expected-warnings to make the tests easier to read.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15 20:41:10 +00:00
Richard Smith e770b05ad5 Add simple, stupid, pattern-based fuzzer / reducer for modules bugs. I've
already used this to find and reduce quite a few bugs, and it works pretty well
if you can find the right patterns.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-27 19:43:46 +00:00
David Majnemer 7bec35427e Use ranges to concisely express iteration
No functional change is intended, this should just clean things up a
little.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 00:15:04 +00:00
Vedant Kumar 311f37bc8a [perf-training] Ignore 'Profile Note' warnings from the runtime
After r272599, -DLLVM_BUILD_INSTRUMENTED passes a default argument to
-fprofile-instr-generate. This confuses the perf-helper script because
the runtime emits a note stating that the default is overridden by the
LLVM_PROFILE_FILE environment variable.

Change the perf-helper script s.t it does not treat these notes as
failures.

This isn't a strictly NFC change, but I don't see a simple way to add a
test for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272695 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 19:06:48 +00:00
Vedant Kumar b1d69700ba Remove stray semi-colon in *.py file, NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14 01:14:50 +00:00
Mike Spertus 2b60a2c0ba Improved Visual Studio visualization of OpaquePtr
Create a special visualizer for OpaquePtr<QualType> because the 
standard visualizer doesn't work with OpaquePtr<QualType>
due to QualType being heavily dependent on traits to be pointer-like.

Also, created an identical visualizer for UnionOpaquePtr


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272531 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 04:02:35 +00:00
Mike Spertus a068e1cafc Visual Studio Visualizer for PackExpansionType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272522 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 22:54:46 +00:00
Mike Spertus 25969c5970 Visual Studio native visualizer for ParsedTemplateArgument
Does a good job with type and non-type template arguments
and lays the groundwork for template template arguments to
visualize well once there is a TemplateName visualizer.
Also fixed what looks like an incorrect comment in the
header for ParsedTemplate.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 22:21:56 +00:00
Mike Spertus 00f3397102 Rudimentary support for Visual Studio Stmt visualizer
Better than nothing...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-12 18:42:04 +00:00
Mike Spertus 13a66b76e4 Visual Studio Visualizers for ActionResult, LocInfoType, and and TypeSourceInfo
Created a visualizer for ActionResult that displayed the validity and the pointer,
but many of them initially displayed poorly. It turns out that the primary culprit
is that LocInfoType is often passed in an action result, but it is not the same 
as other types. For example, LocInfoType is not in TypeNodes.def and clang::Type::TypeClass
does not have a LocInfoType enum. After adding a special visualizer for LocInfoType,
the display was more useful


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272487 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-11 20:15:19 +00:00
Mike Spertus 752bad647c Visual Studio visualizers associated with LookupResults
Visualizers for DeclAccessPair, UnresolvedSet, and LookupResult. For example,
when combined with LLVM diff D21256 (currently in review), a Lookup set will
show much more naturally in the Locals window something like

  Found: {public typename ...Ts}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-11 03:02:33 +00:00
Mike Spertus 090864348e Added missing close brace to OpaquePtr Visual Studio visualizer
This syntax error resulted in garbage being appended to OpaquePtr visualizations


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-10 22:25:43 +00:00
Richard Smith 094ed6b130 Update to match LLVM r272232.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272233 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 00:53:41 +00:00
Mike Spertus 01203ed48e Improve Visual Studio visualization of DeclaratorDecl
With this change, you can now expand its name and type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271966 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 00:27:37 +00:00
Mike Spertus 9fdc667538 Improved Visual Studio visualizations for template argument lists
Improved the visualizer for TemplateArgumentList to show type arguments in the DisplayString.
E.g., <double, long>. Added a visualizer for MultiLevelTemplateArgumentList.
I decided to display them by how they would appear in a template with the
(non-existent) template-id's omitted, so the DisplayString naturally presents
as something like <double, long>::<char *>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 21:41:20 +00:00
Mike Spertus 37921975d7 Fix typo in last submission to visualize proper template argument
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 17:23:37 +00:00
Mike Spertus ca38230516 Better Visual Studio visualization of TemplateArgument and TemplateArgumentList
For pack TemplateArguments, visualize all of the items in the pack
Visualize a TemplateArgumentList as a template argument list. E.g., <int, double>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271910 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 17:08:32 +00:00
Mike Spertus 9855ec1d7f Slightly improve Visual Studio visualization of clang::Expr
Now it gives the StmtClass of the Expr as well as the type. It's still
a long way from full visualization of expressions, but I have found
that having the class really helps when debugging, so definitely
worth submitting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271866 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 03:37:18 +00:00
Reid Kleckner 4083a06092 Work around MinGW's macro definition of 'interface' to 'struct'
Previous attempts to rename the IBOutletCollection argument to something
other than "Interface" were undone (r127127 and r139620).  Instead of
renaming it, work around this in tablegen, so the public facing getter
can have the usual name of 'getInterface'.

Fixes PR26682

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@271305 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-31 17:42:56 +00:00
Benjamin Kramer 4ff480f17c Apply clang-tidy's misc-move-constructor-init throughout Clang.
No functionality change intended, maybe a tiny performance improvement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270996 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 14:27:13 +00:00
Benjamin Kramer 9d37176cc4 Turn copies into references as suggested by clang-tidy's performance-unnecessary-copy-initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270994 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-27 13:36:58 +00:00
Mike Spertus 5337e47eb3 Visualize ellipses in TemplateTypeParm and TemplateTypeParmDecl
Now a TemplateTypeParm will be visualized as typename ...T if it is a pack


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270521 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24 01:47:41 +00:00
Mike Spertus 6e5c617990 Visualizer for Pack template arguments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 22:27:44 +00:00
Richard Smith 284f294745 Fix use-after-free ASan failures for modules / PCH files that deserialize abi_tag or no_sanitize attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269869 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 00:16:51 +00:00
Mike Spertus ea55554521 Simple visualization of expressions
While more could be done, showing the type is a lot better than what is there now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269623 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16 01:36:09 +00:00
Eugene Zelenko 7865cf1f6b Fix Clang-tidy modernize-use-bool-literals in generated code.
Reduce space in empty constructors and between data members and first public section.

Fix some Include What You Use warnings.

Differential revision: http://reviews.llvm.org/D20213


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-12 22:27:08 +00:00
Peter Collingbourne 2febae03d5 Revert unnecessary tblgen change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267788 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 20:49:44 +00:00
Peter Collingbourne 47213cf975 Rework interface for bitset-using features to use a notion of LTO visibility.
Bitsets, and the compiler features they rely on (vtable opt, CFI),
only have visibility within the LTO'd part of the linkage unit. Therefore,
only enable these features for classes with hidden LTO visibility. This
notion is based on object file visibility or (on Windows)
dllimport/dllexport attributes.

We provide the [[clang::lto_visibility_public]] attribute to override the
compiler's LTO visibility inference in cases where the class is defined
in the non-LTO'd part of the linkage unit, or where the ABI supports
calling classes derived from abstract base classes with hidden visibility
in other linkage units (e.g. COM on Windows).

If the cross-DSO CFI mode is enabled, bitset checks are emitted even for
classes with public LTO visibility, as that mode uses a separate mechanism
to cause bitsets to be exported.

This mechanism replaces the whole-program-vtables blacklist, so remove the
-fwhole-program-vtables-blacklist flag.

Because __declspec(uuid()) now implies [[clang::lto_visibility_public]], the
support for the special attr:uuid blacklist entry is removed.

Differential Revision: http://reviews.llvm.org/D18635

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267784 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27 20:39:53 +00:00
Alex Denisov ed1008dbd2 Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

  ## Autogenerated by LLVM/Clang configuration.
  # Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from
configure_lit_site_cfg with the note and some useful information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 06:54:46 +00:00
Chris Bieneman 8a4cb5943a [OrderFiles] Don't allow lit to run dtrace multithreaded
Dtrace is implemented to try and minimize performance impact on the process being traced. This results in dtrace dropping samples if it is taking too many CPU resources. Multi-threading dtrace increases the sample drop rate dramatically.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266213 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-13 17:12:56 +00:00
Chris Bieneman 5f12fe84b1 [Perf-Training] Reworked workflow improvements for order-file generation
This is re-landing r260742. I've reworked the conditionals so that it only hits when targeting Apple platforms with ld64.

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 22:48:18 +00:00
Richard Smith 017686a228 Re-commit r265518 ("[modules] Continue factoring encoding of AST records out of
ASTWriter."), reverted in r265526, with a fix for an iterator invalidation bug
(thanks, MSan!).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 17:06:00 +00:00
Dmitry Polukhin 4efb19c4af Revert "[modules] Continue factoring encoding of AST records out of ASTWriter."
This reverts commit r265518.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 10:01:46 +00:00
Richard Smith e8c1d1f15d [modules] Continue factoring encoding of AST records out of ASTWriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06 06:26:08 +00:00
Mike Spertus c5267a849b Fix redundant "typename typename T" in Visual Studio Native Visualizer
Also, a little minor cleanup


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-04 19:36:48 +00:00
Mike Spertus 2641018c61 Visual Studio native visualizers for clang::TemplateSpecializationType
Displays a template specialization as, say, A<int, double>. Does not
yet handle UncommonTemplateNameStorage, QualifiedTemplateName, or
DependentTemplateName, but still more than worthwhile


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-01 03:31:43 +00:00
Mike Spertus 666c01d585 Visual Studio native visualization for clang::TemplateDecl
With this change, TemplateDecls display in the Locals Window something like

  template<typename T, typename U> struct A;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 06:09:56 +00:00
Mike Spertus cfb7120d2f Visual Studio native visualization for TemplateParameterList and TemplateTypeParmDecl
With this change, a TemplateParameterList will suggestively display in the locals window something like:
  <typename T, int i>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264714 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 10:57:24 +00:00
Mike Spertus 68bb29225f Visual Studio native visualizer for InjectedClassNameType
Also fixes some omissions for TemplateSpecializationType


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 09:24:45 +00:00
Mike Spertus c80318e532 This file was accidentally committed with bad line endings. Fixed...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 19:08:27 +00:00
Mike Spertus 17a76edf1f Use VS2015 Project Support for Natvis to eliminate the need to manually install clang native visualizer
This is the clang equivalent to llvm commit 264601. When using Visual Studio 2015, cmake now puts the native visualizers in llvm.sln, so the developer automatically sees custom visualizations.
Much thanks to ariccio who provided extensive help on this change. (manual installation still needed on VS2013).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264603 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 18:03:37 +00:00
Mike Spertus eed291ac88 Display const/volatile/restrict qualifiers in Visual Studio visualizations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264229 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-24 00:38:54 +00:00
Mike Spertus 820daeb7ce Visualize fields of records as they were declared in Visual Studio debugger
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 17:29:42 +00:00
Chris Bieneman 7b9ada75b9 [Perf-training] Using os.devnull instead of a temp file
This is based on post-commit feedback from Vedant. Totally didn't know that existed and worked on Windows.

Thanks Vedant!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 16:33:23 +00:00
Chris Bieneman f4075790dc [Perf-training] Cleanup based on feedback from Sean Silvas
Sean provided feedback based on r257934 on cfe-commits. This change addresses that feedback.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 16:27:35 +00:00
Chris Bieneman 62da3c4bd4 [Perf-training] Fixing an issue with multi-threading PGO generation
When LIT parallelizes the profraw file generation we need to generate unique temp filenames then clean them up after the driver executes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264021 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 02:55:40 +00:00
Mike Spertus ca2d0f94fa Visual Studio Native Visualizations for constructors and methods
With this change, the class

  struct A {
    A(int _i);
    ~A();
    int foo(double d);
    double bar(A *a) { return 1.3; }
  };

appears in the VS2015 Locals Window as

D              0x02dbb378 struct A
|- DeclKind    CXXRecord
|- Members
 |- [0]        implicit struct A
 |- [1]        Constructor {A(int _i)}
 |- [2]        Destructor {~A()}
 |- [3]        Method {int foo(double d)}
 |- [4]        Method {double bar(struct A *)}
|- [Raw View]  /* Other stuff */

Note that these changes only benefit VS2015 as
VS2013 does not have views and only displays the
struct name "A", but the change does no apparent
harm in VS2013, so is still a win.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 02:29:22 +00:00
Chris Bieneman 2437ac71c6 [Perf-training] Adding support for tests to skip the clang driver
This patch adds a new set of substitutions to the lit run lines for order files and PGO generation which run the clang driver to get the cc1 command, then execute the cc1 command directly. This allows the scripts to bypass profiling the clang driver over and over again.

The approach in this patch was discussed via IRC with Sean Silvas.

Special thanks to Daniel Dunbar whose out-of-tree code I liberally plagiarized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21 22:37:14 +00:00
Mike Spertus dd104f75f1 Visual Studio Visualizers for clang::FunctionDecl
Readably displays a FunctionDecl in the Visual Studio Locals Window something like:
  void g(int, double d, struct A && arr)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263915 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-20 20:15:23 +00:00
Mike Spertus e669011c66 Better visualization of clang::BuiltinType in VisualStudio
Whenever possible, use C++ names for visualizing builtin types. E.g., "long double" instead of "LongDouble"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263891 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-20 00:32:30 +00:00
Mike Spertus 9c966e698d Visual Studio Visualizer for clang::FunctionProtoType
Displays return type and parameters for the Function Protoype object in the Locals window.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263890 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-20 00:20:43 +00:00
Mike Spertus a4c20f8576 Show members of DeclContexts (i.e., class members) in Visual Studio native visualizers
This change shows members of DeclContext objects in the Visual Studio debugger. It will also cast a TagType like a class or a struct to a DeclContext, so its methods and fields are visualized. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-18 16:38:34 +00:00
Manman Ren 081f300e64 Add an optional string argument to DeprecatedAttr for Fix-It.
We only add this to __attribute__((deprecated)).

Differential Revision: http://reviews.llvm.org/D17865


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263652 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 18:50:49 +00:00
Mike Spertus 10d1e7a41e Add visualizers for more clang types. Create more C++-like visualizations for existing Clang types
Created visualizer for PointerType, LValueReferenceType, RValueReferenceType, and TemplateParmType.
In addition, cleaned up the display of existing types to be more C++-like. For example, instead of

  SubstTemplateTypeParmType: {Identifier (("T"))} => Record (25), {Identifier (("A"))}

it now displays more readably as 

  SubstTemplateTypeParmType: {typename T <= struct A}

The <expand> sections still can be used for all the gory details if necessary.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-16 14:27:50 +00:00
Manman Ren d0e1e444b4 Print strict in Availability attribute when it is on.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-10 23:54:12 +00:00
Mike Spertus 2ac86c73e7 Add Visual Studio native visualizers for several Clang types
This is one of a series of changes to improve the MSVC visualization of Clang types.
This one focuses on Record and SubstTemplateTypeParmType meaning that, for example,
a TemplateArgumentLoc no longer displays incomprehensibly in the locals window as

  {Argument={DeclArg={Kind=1 QT=0x033acb00 D=0xcccccccc {DeclType=???}}...

but instead much more usefully as

  Type template parameter: SubstTemplateTypeParm: {Identifier (("T"))} => Record, {Identifier (("A"))}

Additional types and improvements will be made in subsequent commits



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262933 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 16:14:23 +00:00
Richard Smith 14b538d62d P0188R1: add support for standard [[fallthrough]] attribute. This is almost
exactly the same as clang's existing [[clang::fallthrough]] attribute, which
has been updated to have the same semantics. The one significant difference
is that [[fallthrough]] is ill-formed if it's not used immediately before a
switch label (even when -Wimplicit-fallthrough is disabled). To support that,
we now build a CFG of any function that uses a '[[fallthrough]];' statement
to check.

In passing, fix some bugs with our support for statement attributes -- in
particular, diagnose their use on declarations, rather than asserting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 00:32:55 +00:00
John McCall a29b4d2ff1 Semantic analysis for the swiftcall calling convention.
I've tried to keep the infrastructure behind parameter ABI
treatments fairly general.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262587 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 06:39:32 +00:00
John McCall 7f522ba3e9 Add an llvm_unreachable back to the autogeneration of this covered switch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262288 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 02:09:20 +00:00
John McCall a2d53440cf Infrastructure improvements to Clang attribute TableGen.
This should make it easier to add new Attr subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 00:18:05 +00:00
Chandler Carruth a11816e258 [cmake] Revert r260742 (and r260744) to improve order file support.
This appears to be passing '-Wl,-order_file' to Linux link commands,
which then causes the linker to silently, behind the scenes, write the
output to 'rder_file' instead of somewhere else. Will work with Chris to
figure out the proper support for this, but so far there are numerous
people who can't get Clang to update when they build because of this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17 02:13:35 +00:00
Benjamin Kramer c563475a9f Fix a leak in the generated code for attributes with strings.
Storing std::strings in attributes simply doesn't work, we never call
the destructor. Use an array of StringRefs instead of std::strings and
copy the data into memory taken from the ASTContext.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260831 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-13 18:11:49 +00:00
Chris Bieneman cff69f62d5 [CMake] Improve the clang order-file generation workflow
Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was attempting to check if a linker flag worked, the test was passing it to the compiler, not the linker. CMake doesn't have a linker test, so we have a hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16999

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260742 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 21:36:55 +00:00
Chris Bieneman 23347e5957 Revert "[CMake] Improve the clang order-file generation workflow"
This reverts commit r259862, and attempts to fix builder CMakeCaches.

Will try this again some other time...

Conflicts:

	CMakeLists.txt
	tools/driver/CMakeLists.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259872 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 03:40:37 +00:00
Chris Bieneman 492a6e3e44 [CMake] Improve the clang order-file generation workflow
Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16896

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-05 01:22:03 +00:00
Chris Bieneman 749c9c251e Add back the ABITest makefiles
These files are standalone and not integrated with CMake, so we probably want them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259667 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-03 17:16:01 +00:00
Craig Topper e9cc0aa18f No need to use utostr when putting integers into a raw_ostream. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259310 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-31 00:20:26 +00:00
Chris Bieneman 171280519b Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

    "This is the way [autoconf] ends
    Not with a bang but a whimper."
    -T.S. Eliot

Reviewers: chandlerc, grosbach, bob.wilson, echristo

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D16472

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258862 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:30:40 +00:00
Devin Coughlin 1d03689e53 [analyzer] SATestBuild.py: Remove html and log when producing reference results.
The html reports are huge -- every issue in a given file results in a separate
copy of the source code, in HTML form, for the file. This gets very large
quickly and it doesn't make sense to check this into a reference repository.
Also remove the log when generating reference results because it can leak
absolute path names. We still keep both the html and the log around when
producing non-reference results.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258594 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-23 01:09:07 +00:00
Devin Coughlin 84b659738b [analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.
I missed this one in r258493.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258517 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:45:22 +00:00
Devin Coughlin 01a74c4d2d [analyzer] Update SATestBuild.py to handle spaces in paths.
The Jenkins workspace on the new Green Dragon builder for the static analyzer has spaces
in its path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 07:08:06 +00:00
Craig Topper fe08b36af9 [TableGen] Merge the SuperClass Record and SMRange vector a single vector. This removes the state needed to manage the extract vector. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258066 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 19:52:54 +00:00
Chris Bieneman 797e525e14 [CMake] Fix bots broken by including order file generation in check-all
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 22:44:18 +00:00
Chris Bieneman 880efe947e [CMake] [Order-files] Use print_function as an attempt at being forward compatible.
Based on feedback from bogner.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 21:30:06 +00:00
Chris Bieneman d25ff15a65 [CMake] Support generation of linker order files using dtrace
Summary:
This patch extends the lit-based perf-training tooling supplied for PGO data generation to also generate linker order files using dtrace.

This patch should work on any system that has dtrace. If CMake can find the dtrace tool it will generate a target 'generate-order-file' which will run the per-training tests wrapped by dtrace to capture function entries. There are several algorithms implemented for sorting the order files which can be experimented with for best performance. The dtrace wrapper also supports bot oneshot and pid probes.

The perf-helper.py changes to support order file construction are ported from internal changes by ddunbar; he gets all the credit for the hard work here, I just copy and pasted.

Note: I've tested these patches on FreeBSD and OS X 10.10.

Reviewers: ddunbar, bogner, silvas

Subscribers: llvm-commits, emaste

Differential Revision: http://reviews.llvm.org/D16134

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257934 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 21:21:12 +00:00
Craig Topper 74eb2f0617 [TableGen] Call llvm_shutdown on exit so that all the ManagedStatic objects in the support library will be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 04:51:46 +00:00
Chris Bieneman f77379b0d1 [CMake] Fixing a typo in a flag
Turns out cc1's flag has 1 - not 2...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19 00:56:12 +00:00
Chris Bieneman 7bce75b412 [CMake] PGO training data
Adding in a few more lit substitutions for cc1 and the test exec path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256057 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18 23:00:57 +00:00
Chris Bieneman a0e3cedafc [CMake] Add support for generating profdata for clang from training files
Summary:
This patch adds support for using LIT to drive generating PGO profile data for clang.

This first pass implementation should work on Linux and Unix based platforms. If you build clang using CMake with LLVM_BUILD_INSTRUMENTED=On the CMake build generates a generate-profdata target that will use the just-built clang to build any test files (see hello_world.cpp as an example). Each test compile will generate profraw files for each clang process. After all tests have run CMake will merge the profraw files using llvm-profdata.

Future opportunities for extension:
* Support for Build->Profile->Build bootstrapping
* Support for linker order file generation using a similar mechanism and the same training data
* Support for Windows

Reviewers: dexonsmith, friss, bogner, cmatthews, vsk, silvas

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D15462

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255740 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 01:02:44 +00:00
Eugene Zelenko 5e20163601 Use range loops and autos in utils/TableGen/ClangAttrEmitter.cpp and generated code.
Differential revision: http://reviews.llvm.org/D15313


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255042 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08 18:49:01 +00:00
Aaron Ballman f1e212a7a9 Do not crash when dumping the objc_bridge_related attribute when its optional arguments are not supplied.
Patch thanks to Joe Ranieri!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-30 15:25:34 +00:00
Devin Coughlin 6817029164 [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.
Currently the SATestBuild.py and SATestAdd.py buildbot scripts expect project
sources to be checked into the project repository. This commit changes these
scripts to additionally support a model where project sources are downloaded
rather than checked into the repository. Sometimes projects may need to be
modified (for example, to support a newer versions of clang), so the updated scripts
also allow for an optional patch file that will be applied to the downloaded
project source before analysis.

To support this workflow, this commit changes the expected layout of
a project in the repository. The project-specific helper scripts will stay
in the root of each project directory, but the benchmark source itself (if
checked into the repo) should now be stored in a subdirectory named
'CachedSource':

  project_name/
    cleanup_run_static_analyzer.sh [optional]
    run_static_analyzer.cmd [required]
    download_project.sh [optional]
    CachedSource/ [optional]
    changes_for_analyzer.patch [optional]

If the 'CachedSource' source directory is not present, the download script will
be executed. This script should download the project source into 'CachedSource'.
Then, if 'changes_for_analyzer.patch' is present its changes will
be applied to a copy of 'CachedSource' before analysis.

Differential Revision: http://reviews.llvm.org/D14345

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-07 18:27:35 +00:00
John McCall 68098861a7 Add the ability to define "fake" arguments on attributes.
Fake arguments are automatically handled for serialization, cloning,
and other representational tasks, but aren't included in pretty-printing
or parsing (should we eventually ever automate that).

This is chiefly useful for attributes that can be written by the
user, but which are also frequently synthesized by the compiler,
and which we'd like to remember details of the synthesis for.
As a simple example, use this to narrow the cases in which we were
generating a specialized note for implicitly unavailable declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-28 00:17:34 +00:00
Gabor Horvath 61a690a04f [analyzer] Bug identification
This patch adds hashes to the plist and html output to be able to identfy bugs
for suppressing false positives or diff results against a baseline. This hash
aims to be resilient for code evolution and is usable to identify bugs in two
different snapshots of the same software. One missing piece however is a 
permanent unique identifier of the checker that produces the warning. Once that
issue is resolved, the hashes generated are going to change. Until that point
this feature is marked experimental, but it is suitable for early adoption.

Differential Revision: http://reviews.llvm.org/D10305 

Original patch by: Bence Babati!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251011 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 11:53:04 +00:00
Alexey Bataev 52bc812d7e [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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250017 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 06:59:48 +00:00
Hans Wennborg 94faed6137 Fix Clang-tidy modernize-use-nullptr warnings in source directories; other minor cleanups
Patch by Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D13406

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249484 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-06 23:40:43 +00:00
Hans Wennborg 5e171f9c91 Fix Clang-tidy modernize-use-nullptr warnings in headers and generated files; other minor cleanups.
By Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D13187

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 20:56:43 +00:00
Aaron Ballman 6bcca76d74 Added MSVC natvis visualizers for Type and QualType. These could probably be improved, but anything is better than staring at hex values in the debugger.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 17:32:36 +00:00
Devin Coughlin 2e47fee790 [analyzer] SATestBuild.py: Move additional checkers logic so SATestAdd.py can use it as well.
Move the logic looking for additional checkers in the SA_ADDITIONAL_CHECKERS
environmental variable from SATestBuild's main() to runScanBuild(). This allows
SATestAdd.py to use the variable as well. Without it, we won't include
additional checkers when building reference results for the build bot.

Differential Revision: http://reviews.llvm.org/D12891

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247767 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 01:52:32 +00:00
Devin Coughlin ea63792547 [analyzer] Update SATestBuild.py to set -isysroot for preprocessed files
Update the static analyzer buildbot script to set -isysroot to the OS X SDK path
when analyzing preprocessed files on OS X.

Differential Revision: http://reviews.llvm.org/D12769

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 21:22:24 +00:00
Aaron Ballman 9f3c767b29 Extend the Token visualizer used by MSVC to display the identifier text for tok::identifier tokens.
Patch by Mike Spertus.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247442 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 18:35:18 +00:00
Ted Kremenek 99bb39afb4 [analyzer] Apply whitespace cleanups by Honggyu Kim.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246978 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 03:50:52 +00:00
Ahmed Bougacha 4241f944e8 [ARM NEON] Remove special-case for f16 vcvt handling. NFCI.
We can use the 'H' typespec modifier to use 128-bit vectors directly
in the only two users of this special-case: the vcvt f16 intrinsics.
This also lets us use more meaningful prototype modifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 01:30:13 +00:00
Ahmed Bougacha 1547b6ad9b [ARM NEON] Use the common naming scheme for vcvt f16 builtins. NFC.
We had "vcvt_f16" and "VCVT_HIGH_F16": for other FP types, this naming
is used for intrinsics with integer overloads. The FP->FP conversions,
on the other hand, use the full "vcvt_f32_f64" name instead.

Use the same naming convention for the f16<->f32 conversions.
While there, reorder the definitions a little bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245763 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 23:34:20 +00:00
Ahmed Bougacha 8dd1104044 [ARM NEON] Factor out FP-prototype checking. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 23:24:18 +00:00
Gabor Horvath 5b3f95829b [Static Analyzer] Made it easier to test new checkers using the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245637 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-20 22:59:49 +00:00
David Blaikie 2cdd8a6534 Fix memory ownership in the NeonEmitter by using values instead of pointers (smart or otherwise)
Improvement to the memory leak fix in 244196.

Address validity is required for the Intrinsic objects, but since the
collections only ever grow (no elements are removed), deque provides
sufficient guarantees (that the objects will never be reallocated/moved
around) for this use case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 18:29:32 +00:00
Yaron Keren f02202b208 Plug a memory leak in NeonEmitter: Intrinsics allocated were never released.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244196 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 07:28:36 +00:00
Chandler Carruth 49ebe63bb6 [UB] Guard two calls to memcpy in generated attribute code to handle
null StringRef objects as inputs.

Found by UBSan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 03:53:01 +00:00
Hans Wennborg c13dd1b3b8 Fix -Wextra-semi warnings.
Patch by Eugene Zelenko!

Differential Revision: http://reviews.llvm.org/D11401

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242931 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 20:46:26 +00:00
Bob Wilson b8f61114ae Refactor TableGen backend for ClangAttrEmitter to avoid duplication.
GenerateHasAttrSpellingStringSwitch and GenerateTargetRequirements had
duplicated code to check the conditions for target-specific attributes.
Refactor the duplicated code into a separate function. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242731 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 22:57:36 +00:00
Bob Wilson 4e5f9fb46e Ignore the "novtable" declspec when not using the Microsoft C++ ABI.
Clang used to silently ignore __declspec(novtable). It is implemented
now, but leaving the vtable uninitialized does not work when using the
Itanium ABI, where the class layout for complex class hierarchies is
stored in the vtable. It might be possible to honor the novtable
attribute in some simple cases and either report an error or ignore
it in more complex situations, but it’s not clear if that would be
worthwhile. There is also value in having a simple and predictable
behavior, so this changes clang to simply ignore novtable when not using
the Microsoft C++ ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-20 22:57:31 +00:00
Gabor Horvath 7d70c91050 [Static Analyzer] Make the paths relative from the project root when generating reference results in the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241706 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 18:39:31 +00:00
Craig Topper 9a5bfce2e0 [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-06 06:23:06 +00:00
Gabor Horvath cbe5bbcbf0 [Static Analyzer] No longer include the full path of the source file in the single file tests' bug identifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241292 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 19:20:46 +00:00
Gabor Horvath 939c4bfc23 [Static Analyzer] Minor improvements to SATest.
Differential Revision: http://reviews.llvm.org/D10812


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241073 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-30 15:31:17 +00:00
Alexander Kornienko 8ca7705aa3 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 23:07:51 +00:00
Alexander Kornienko ac58acc7f2 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

  $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
      -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
      work/llvm/tools/clang

To reduce churn, not touching namespaces spanning less than 10 lines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-22 09:47:44 +00:00
Douglas Gregor d442f4a26c Check for consistent use of nullability type specifiers in a header.
Adds a new warning (under -Wnullability-completeness) that complains
about pointer, block pointer, or member pointer declarations that have
not been annotated with nullability information (directly or inferred)
within a header that contains some nullability annotations. This is
intended to be used to help maintain the completeness of nullability
information within a header that has already been audited.

Note that, for performance reasons, this warning will underrepresent
the number of non-annotated pointers in the case where more than one
pointer is seen before the first nullability type specifier, because
we're only tracking one piece of information per header. Part of
rdar://problem/18868820.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240158 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-19 18:27:45 +00:00
Ahmed Bougacha ef41dd7517 [CodeGen][NEON] Emit constants for "immediate" intrinsic arguments.
On ARM/AArch64, we currently always use EmitScalarExpr for the immediate
builtin arguments, instead of directly emitting the constant. When the
overflow sanitizer is enabled, this generates overflow intrinsics
instead of constants, breaking assumptions in various places.

Instead, use the knowledge of "immediates" to directly emit a constant:
- teach the tablegen backend to emit the "immediate" modifiers
- use those modifiers in the NEON CodeGen, on ARM and AArch64.

Fixes PR23517.

Differential Revision: http://reviews.llvm.org/D10045


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239002 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 01:43:41 +00:00
Russell Gallop b5152d2c03 [utils] Improvements to check_cfc.py to work better with some build systems.
Recognise options to output dependency files and don't perform checks.
Report input file name when reporting a check failure so it is more obvious in large build logs.

Differential Revision: http://reviews.llvm.org/D10183

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238928 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 15:09:13 +00:00
Russell Gallop 2b31c3dfe2 [utils] Add exact check to check_cfc.py dash_s_no_change.
Files compiled with -via-file-asm should be byte for byte identical. This
change improves the checking on dash_s_no_change to detect non-code
differences. If there is a difference, the check goes on to compare code and
debug to try and be more informative.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 14:33:57 +00:00
Benjamin Kramer b7b56528f9 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
If the type isn't trivially moveable emplace can skip a potentially
expensive move. It also saves a couple of characters.


Call sites were found with the ASTMatcher + some semi-automated cleanup.

memberCallExpr(
    argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
    on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
    hasArgument(0, bindTemporaryExpr(
                       hasType(recordDecl(hasNonTrivialDestructor())),
                       has(constructExpr()))),
    unless(isInTemplateInstantiation()))

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 19:42:19 +00:00
Peter Collingbourne bb987e72f3 Implement no_sanitize attribute.
Differential Revision: http://reviews.llvm.org/D9631

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-15 18:33:32 +00:00
Craig Topper 5e92fff2a9 [TableGen] Clang changes for r235697 to stop leaking Expanders and Operators in SetTheory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 06:53:50 +00:00
Ulrich Weigand d85ab2e6f3 Implement target-specific __attribute__((aligned)) value
The GCC construct __attribute__((aligned)) is defined to set alignment
to "the default alignment for the target architecture" according to
the GCC documentation:

  The default alignment is sufficient for all scalar types, but may not be
  enough for all vector types on a target that supports vector operations.
  The default alignment is fixed for a particular target ABI.

clang currently hard-coded an alignment of 16 bytes for that construct,
which is correct on some platforms (including X86), but wrong on others
(including SystemZ).  Since this value is ABI-relevant, it is important
to get correct for compatibility purposes.

This patch adds a new TargetInfo member "DefaultAlignForAttributeAligned"
that targets can set to the appropriate default __attribute__((aligned))
value.

Note that I'm deliberately *not* using the existing "SuitableAlign"
value, which is used to set the pre-defined macro __BIGGEST_ALIGNMENT__,
since those two values may not be the same on all platforms.  In fact,
on X86, __attribute__((aligned)) always uses 16-byte alignment, while
__BIGGEST_ALIGNMENT__ may be larger if AVX-2 or AVX-512 are supported.
(This is actually not yet correctly implemented in clang either.)

The patch provides a value for DefaultAlignForAttributeAligned only for
SystemZ, and leaves the default for all other targets at 16, which means
no visible change in behavior on all other targets.  (The value is still
wrong for some other targets, but I'd prefer to leave it to the target
maintainers for those platforms to fix.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235397 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-21 17:29:35 +00:00
Benjamin Kramer 33fe0182f3 Remove empty non-virtual destructors or mark them =default when non-public
These add no value but can make a class non-trivially copyable. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234689 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11 15:58:30 +00:00
Alexander Kornienko dfa4cf3126 Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D8926

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234678 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11 02:00:23 +00:00
Benjamin Kramer 420fd99bc3 [tblgen] Use StringRef::trim
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234643 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 21:37:21 +00:00
James Dennett bfab8535c0 Fix a call to std::unique to actually discard the trailing (junk) elements.
Found by inspection.  (No other instances of this problem were found.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234221 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-06 21:09:24 +00:00
Russell Gallop f816d16553 [utils] Add Check Compile Flow Consistency tool (check_cfc.py).
This is a tool for checking consistency of code generation with different
compiler options (such as -g or outputting to .s). This tool has found a number
of code generation issues. The script acts as a wrapper to clang or clang++
performing 2 (or more) compiles then comparing the object files. Instructions
for use are in check_cfc.py including how to use with LNT.

Differential Revision: http://reviews.llvm.org/D8723


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233919 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02 15:01:53 +00:00
Benjamin Kramer 5d00c12060 Devirtualize Attr and all subclasses.
We know all subclasses in tblgen so just generate a giant switch for
the few virtual methods or turn them into a member variable using spare
bits. The giant jump tables aren't pretty but still much smaller than
a vtable for every attribute, shrinking Release+Asserts clang by ~400k.

Also halves the size of the Attr base class. No functional change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232726 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19 16:06:49 +00:00
Yaron Keren 9bd91b686a Remove many superfluous SmallString::str() calls.
Now that SmallString is a first-class citizen, most SmallString::str()
calls are not required. This patch removes a whole bunch of them, yet
there are lots more.

There are two use cases where str() is really needed:
1) To use one of StringRef member functions which is not available in
SmallString.
2) To convert to std::string, as StringRef implicitly converts while 
SmallString do not. We may wish to change this, but it may introduce
ambiguity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232622 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-18 10:17:07 +00:00
Benjamin Kramer 2e67a40f63 Make helper functions static. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 18:24:01 +00:00
Aaron Ballman 91f2b9ec1e The semantic spelling enumeration should retain values to the spelling list indexes used by the attribute. The only attribute affected by this in practice is the OpenCLImageAccessAttr, which has duplicate semantic spellings that are automatically stripped.
We do not implicitly create an OpenCLImageAccessAttr, so this change only affects out of tree users. There is no way to test this behavior specifically that I can see, since this only affects implicit creation of attributes.

Fixes PR22403.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231803 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 17:19:18 +00:00
Yaron Keren 1acd90385d Teach raw_ostream to accept SmallString.
Saves adding .str() call to any raw_ostream << SmallString usage
and a small step towards making .str() consistent in the ADTs by
removing one of the SmallString::str() use cases, discussion at

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html

I'll update the Phabricator patch http://reviews.llvm.org/D6372
for review of the Twine SmallString support, it's more complex
than this one.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231763 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10 07:33:23 +00:00
Alexander Kornienko 8785e3e9a0 Replace size() calls on containers with empty() calls where appropriate. NFC
http://reviews.llvm.org/D7090

Patch by Gábor Horváth!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226914 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-23 15:36:10 +00:00
Chandler Carruth f3590b88bc [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225975 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:23:58 +00:00
Aaron Ballman c77fbd026e Attributes accepting an EnumArgument are allowed to pass a string literal, or an identifier. VariadicEnumArguments now behave consistently instead of only accepting a string literal.
This change affects the only attribute accepting a variadic enumeration: callable_when.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224582 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-19 16:42:04 +00:00
Aaron Ballman e3446ce886 Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223468 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 15:24:55 +00:00
Sean Hunt 6724817052 Create a new 'flag_enum' attribute.
This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.

Reviewed by Aaron Ballman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222906 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-28 00:53:20 +00:00
Aaron Ballman b8797a2d0f Fixing a use of stringstream to use an LLVM helper function. Drive-by fixing header include order. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222151 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 18:17:19 +00:00
Aaron Ballman ac7d62cc87 MinGW doesn't implement std::to_string; working around it. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222033 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 20:31:50 +00:00
Aaron Ballman 9135eee6f5 Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221991 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 13:44:02 +00:00
Anna Zaks 9d3048ab77 [analyzer] Rename NewDeleteLeaks checker in the test script.
Fixup to r220289.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 17:40:14 +00:00
Richard Smith 1f064ca0a9 Refactor tree printing in AST dumping.
Instead of manually maintaining a flag indicating whether we're about to print
out the last child of the parent node (to determine whether we print "`" or
"|"), capture a callable to print that child and defer printing it until we
either see a next child or finish the parent.

No functionality change intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220930 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-30 21:02:37 +00:00
Tyler Nowicki 41d599b9c7 Allow constant expressions in pragma loop hints.
Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).

Reviewed by Richard Smith


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219589 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-12 20:46:07 +00:00
Aaron Ballman 6eb5757e25 Adding some FIXMEs to the attribute emitter code regarding whether pretty printing enumerators should use quoted string literals, or identifiers. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15 16:16:14 +00:00
Aaron Ballman 663b4dd44e When pretty printing attributes that have enumeration arguments, print the enumerator identifier (as a string literal) instead of the internal enumerator integral value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217771 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15 15:14:13 +00:00
Craig Topper bbac840f3c Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216528 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 06:28:36 +00:00
Daniel Sanders ef943a962e Fix invalid test generation by utils/ABITest/ABITestGen.py when the same enum is generated more than once.
When generating records/unions, the same enum type may be generated more
than once (with different names). In these cases, the name of the enum
values are not sufficiently unique to prevent multiple declarations. E.g:
  typedef enum T3 { enum0val0 } T3;
  typedef T3 T2[3];
  typedef enum T4 { enum0val0 } T4;
  typedef union T1 { T2 field0; T4 field1; char field2; } T1;

Added a unique suffix to enum values so that multiple identical enum types do
not use the same enum value names.

One example of this bug is produced by:
  ABITestGen.py --no-unsigned --no-vector --no-complex --no-bool \
                --max-args 0 --max-record-depth 1 -o inputs/test.9921.a.c \
                -T inputs/test.9921.b.c -D inputs/test.9921.driver.c \
                --min=9921 --count=1


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216166 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 10:13:49 +00:00
David Blaikie 630cbfce16 Remove some transient raw pointer ownership in ClangAttrEmitter::createArgument
This function might be a bit easier if it were split in two with a lot
of early returns - and that setOptional bit in the outer function, but
anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215263 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 23:59:38 +00:00
Benjamin Kramer b6ac242f5e Add missing header guards.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215202 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 13:24:19 +00:00
Aaron Ballman 18dfa9d42e The GNU-style aligned attribute has an optional expression, but the generated pretty printing logic was unaware of this. Fixed the pretty printing logic, and added a test to ensure it no longer asserts.
Added a FIXME to the code about eliding the parenthesis when pretty printing such a construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214513 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 13:49:00 +00:00
Aaron Ballman 60ec5f80d2 Automate attribute argument count semantic checking when there are variadic or optional arguments present. With this, the only time you should have to manually check attribute argument counts is when HasCustomParsing is set to true, or when you have variadic arguments that aren't really variadic (like ownership_holds and friends).
Updating the diagnostics in the launch_bounds test since they have been improved in that case. Adding a test for nonnull since it has little test coverage, but has truly variadic arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-31 16:37:04 +00:00
Aaron Ballman 7b183ffd3e Specifying the diagnostic argument through the attribute table generator instead of having to enter it manually as part of the attribute subject list. This only affects attributes appertaining to ObjC interfaces and protocols.
No new tests required as this is covered by existing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213193 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 20:28:10 +00:00
Alp Toker c7645b9266 Fix typos
Also consolidate 'backward compatibility'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212974 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 19:42:55 +00:00
James Molloy f19ae32477 [ARM-BE] Generate correct NEON intrinsics for big endian systems.
The NEON intrinsics in arm_neon.h are designed to work on vectors
"as-if" loaded by (V)LDR. We load vectors "as-if" (V)LD1, so the
intrinsics are currently incorrect.

This patch adds big-endian versions of the intrinsics that does the
"obvious but dumb" thing of reversing all vector inputs and all
vector outputs. This will produce extra REVs, but we trust the
optimizer to remove them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211893 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 11:53:35 +00:00
Zachary Turner a9bcfc16cf Add a Visualizer for VarDecl.
Reviewed by: Aaron Ballman

Differential Revision: http://reviews.llvm.org/D4303

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211788 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 16:26:42 +00:00
Aaron Ballman 0d9014e8f3 Fixing the position of the supported syntax marker when generating attribute documentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211692 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 12:48:06 +00:00
Craig Topper ebcdb1ed2f Replace some assert(0)'s with llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211143 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 05:13:13 +00:00
Craig Topper 6356f564c3 Replace some assert(0)'s with llvm_unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 03:57:25 +00:00
Craig Topper ce9d90b35a Convert assert(0) to llvm_unreachable to silence a warning about Addend being uninitialized in default case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211138 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 03:13:41 +00:00
James Molloy ac41a1b787 Rewrite ARM NEON intrinsic emission completely.
There comes a time in the life of any amateur code generator when dumb string
concatenation just won't cut it any more. For NeonEmitter.cpp, that time has
come.

There were a bunch of magic type codes which meant different things depending on
the context. There were a bunch of special cases that really had no reason to be
there but the whole thing was so creaky that removing them would cause something
weird to fall over. There was a 1000 line switch statement for code generation
involving string concatenation, which actually did lexical scoping to an extent
(!!) with a bunch of semi-repeated cases.

I tried to refactor this three times in three different ways without
success. The only way forward was to rewrite the entire thing. Luckily the
testing coverage on this stuff is absolutely massive, both with regression tests
and the "emperor" random test case generator.

The main change is that previously, in arm_neon.td a bunch of "Operation"s were
defined with special names. NeonEmitter.cpp knew about these Operations and
would emit code based on a huge switch. Actually this doesn't make much sense -
the type information was held as strings, so type checking was impossible. Also
TableGen's DAG type actually suits this sort of code generation very well
(surprising that...)

So now every operation is defined in terms of TableGen DAGs. There are a bunch
of operators to use, including "op" (a generic unary or binary operator), "call"
(to call other intrinsics) and "shuffle" (take a guess...). One of the main
advantages of this apart from making it more obvious what is going on, is that
we have proper type inference. This has two obvious advantages:

  1) TableGen can error on bad intrinsic definitions easier, instead of just
     generating wrong code.
  2) Calls to other intrinsics are typechecked too. So
     we no longer need to work out whether the thing we call needs to be the Q-lane
     version or the D-lane version - TableGen knows that itself!

Here's an example: before:

  case OpAbdl: {
    std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)";
    if (typestr[0] != 'U') {
      // vabd results are always unsigned and must be zero-extended.
      std::string utype = "U" + typestr.str();
      s += "(" + TypeString(proto[0], typestr) + ")";
      abd = "(" + TypeString('d', utype) + ")" + abd;
      s += Extend(utype, abd) + ";";
    } else {
      s += Extend(typestr, abd) + ";";
    }
    break;
  }

after:

  def OP_ABDL     : Op<(cast "R", (call "vmovl", (cast $p0, "U",
                                                       (call "vabd", $p0, $p1))))>;

As an example of what happens if you do something wrong now, here's what happens
if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U",
$p0):

arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)'
Available overloads:
  - float64x2_t vabdq_v(float64x2_t, float64x2_t)
  - float64x1_t vabd_v(float64x1_t, float64x1_t)
  - float64_t vabdd_f64(float64_t, float64_t)
  - float32_t vabds_f32(float32_t, float32_t)
... snip ...

This makes it seriously easy to work out what you've done wrong in fairly nasty
intrinsics.

As part of this I've massively beefed up the documentation in arm_neon.td too.

Things still to do / on the radar:
  - Testcase generation. This was implemented in the previous version and not in
    the new one, because
    - Autogenerated tests are not being run. The testcase in test/ differs from
      the autogenerated version.
    - There were a whole slew of special cases in the testcase generation that just
      felt (and looked) like hacks.
    If someone really feels strongly about this, I can try and reimplement it too.
  - Big endian. That's coming soon and should be a very small diff on top of this one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 13:11:27 +00:00
Alp Toker 0860a908c0 Use the ShowInSystemHeader bit consistently for all diagnostics
By describing system header suppressions directly in tablegen we eliminate
special cases in getDiagnosticSeverity().

Dropping the reliance on builtin diagnostic classes when mapping also gets us
closer to the goal of reusing the diagnostic machinery for custom diagnostics.

No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211023 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 13:56:47 +00:00
Tyler Nowicki fe84cfe700 Adds a Pragma spelling for attributes to tablegen and makes use of it for loop
hint attributes. Includes tests for pragma printing and for attribute order
which is incorrectly reversed by ParsedAttributes.

Reviewed by Aaron Ballman


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210925 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13 17:57:25 +00:00
Alp Toker 18a9b66542 Complete the switch from mappings to declarative diagnostic severities
This begins to address cognitive dissonance caused by treating the Note
diagnostic level as a severity in the diagnostic engine.

No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210758 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12 10:15:20 +00:00
Richard Trieu 8a84096523 Removing an "if (this == nullptr)" check from two print methods. The condition
will never be true in a well-defined context.  The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210498 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-09 22:53:25 +00:00
Hans Wennborg ffc3500bc9 Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flags
I was bitten by this when working with the dll attributes: when a dll
attribute was cloned from a class template declaration to its
specialization, the Inherited flag didn't get cloned.

Differential Revision: http://reviews.llvm.org/D3972

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-31 01:30:30 +00:00
Nikola Smiljanic be481708fb Refactoring. Remove release and take methods from ActionResult. Rename takeAs to getAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 10:55:11 +00:00
Alp Toker 7a1672c5c2 utils/CmpDriver: add brief documentation to indicate what this does
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209268 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 02:08:10 +00:00
Aaron Ballman 4bc6889c26 Cleaning up some range-based for loops so that the automatic type deduction is more explicit about pointers and const. Did some minor drive-by const correctness fixes and identifier updates as well. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209233 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-20 19:47:14 +00:00
Aaron Ballman 8a04753c6c None of these attributes require FunctionTemplate to be explicitly listed as part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl.
The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209209 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-20 14:10:53 +00:00
Craig Topper a797c529a6 [C++11] Use 'nullptr'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 06:21:57 +00:00
Tobias Grosser f65fb7ca9e tblgen: Modularize the diagnostic emitter
Replace a large monolitic function, with per-table functions which all nicely
fit on my screen. I also added documentation to each function that describes
what kind of tables are generated and which information is contained and
switched to range based for loops. Finally, I run clang-format over the moved
code.

I spent a significant amount of time to understand this code when reasoning
about possible extensions to the diagnostic interface to support 'remark'
diagnostics. This change will definitely help such an implementation, but
already by itself it will save other people a lot of time when trying to
understand this functionality.

Even though the patch touches the full function, it is mostly mechanical. No
functional change intended. The generated tblgen files are identical.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208136 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-06 22:06:56 +00:00
Aaron Ballman 03ebcc8297 Updated the attribute tablegen emitter for variadic arguments to emit a range accessor in addition to the iterators. Updated code using iterators to use range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207837 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 13:35:42 +00:00
Aaron Ballman f3fa16f5bf Fixing a FIXME -- no longer using std::memcpy, since that would fail for non-trivial types. Replaced with std::copy. No functional changes intended since all uses of this functionality either use pointers or integers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207766 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-01 15:21:03 +00:00
Dmitri Gribenko 89a92d3570 Comment parsing: remove HTML attribute validation
Since the community says that a blacklist is not good enough, and I don't have
enough time now to implement a proper whitelist, let's just remove the
attribute validation.

But, nevertheless, we can still communicate in the generated XML if our parser
found an issue with the HTML.  But this bit is best-effort and is specifically
called out in the schema as such.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207712 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-30 21:54:30 +00:00
Dmitri Gribenko e36bbd1eec Comment parsing: in the generated XML file, mark HTML that is safe to pass
through to the output even if the input comment comes from an untrusted source

Attribute filtering is currently based on a blacklist, which right now includes
all event handler attributes (they contain JavaScipt code).  It should be
switched to a whitelist, but going over all of the HTML5 spec requires a
significant amount of time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206882 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22 10:59:13 +00:00
Aaron Ballman 3056e7cbc9 Reapplying r204952 a second time.
Clean up the __has_attribute implementation without modifying its behavior. 

Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).

Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205181 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-31 13:14:44 +00:00
Aaron Ballman f07112514c Reverting r204968 and r204969; while more build bots are happy with the results, some still have link errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204974 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 22:37:56 +00:00
Aaron Ballman 28dc6f98d2 Reapplying r204952 with fixes which should hopefully resolve linking issues with non-MSVC compilers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204968 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 22:12:09 +00:00
Aaron Ballman d35cc359e1 Reverting r204952, while I figure out what's going on with the makefile build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204955 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 20:36:32 +00:00