Commit Graph

988 Commits

Author SHA1 Message Date
Richard Smith b2c82a6970 Improve workaround for Sphinx's lack of support for command line options containing '+', '.' etc. to be more stable as the set of options changes.
llvm-svn: 293252
2017-01-27 01:54:42 +00:00
Richard Smith 081ad4d3e5 [docs] Add TableGen-based generator for command line argument documentation,
and generate documentation for all (non-hidden) options supported by the
'clang' driver.

llvm-svn: 292968
2017-01-24 19:39:46 +00:00
David L. Jones 267b884e81 Switch TableGen to emit calls to ASTRecordReader for AttrPCHRead.
Summary:
This patch changes TableGen-generated code in AttrPCHRead to call functions on
ASTRecordReader, instead of passing separate parameters to ASTReader. This is a
follow-up to r290217.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 292868
2017-01-24 01:04:30 +00:00
Justin Lebar 4086fe5cd1 [TableGen] Only normalize the spelling of GNU-style attributes.
Summary:
When Sema looks up an attribute name, it strips off leading and trailing
"__" if the attribute is GNU-style.  That is, __attribute__((foo)) and
__attribute__((__foo__)) are equivalent.

This is only true for GNU-style attributes.  In particular,
__declspec(__foo__) is not equivalent to __declspec(foo), and Sema
respects this difference.

This patch fixes TableGen to match Sema's behavior.  The spelling
'GNU<"__foo__">' should be normalized to 'GNU<"foo">', but
'Declspec<"__foo__">' should not be changed.

This is necessary to make CUDA compilation work on Windows, because e.g.
the __device__ attribute is spelled __declspec(__device__).

Attr.td does not contain any Declspec spellings that start or end with
"__", so this change should not affect any other attributes.

Reviewers: rnk

Subscribers: cfe-commits, tra

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

llvm-svn: 291129
2017-01-05 16:51:54 +00:00
Alexander Shaposhnikov be16876e89 [clang] Update lit config in utils/perf-training
This diff replaces --driver-mode=cpp in
utils/perf-training/order-files.lit.cfg and
utils/perf-training/lit.cfg with --driver-mode=g++.
clang --driver-mode=cpp will call the preprocessor and will not
trigger compilation.

Differential revision: https://reviews.llvm.org/D28269

llvm-svn: 290936
2017-01-04 04:33:28 +00:00
Alexander Shaposhnikov fd7afa73b6 [clang] Fix clean build of generate-order-file
This diff fixes the clean build of the target generate-order-file.
In llvm/tools/clang/CMakeLists.txt 
add_subdirectory(utils/perf-training) should go after the block where 
the value of the variable CLANG_ORDER_FILE is set - otherwise 
(tested with cmake's version 3.6.2) the arguments of perf-helper.py gen-order-file
will be ill-formed (CLANG_ORDER_FILE will be empty).

Differential revision: https://reviews.llvm.org/D28153

llvm-svn: 290781
2016-12-31 05:25:52 +00:00
Matthias Braun f1b01996ef Adapt to llvm/TableGen DagInit changes.
llvm-svn: 288645
2016-12-05 06:00:51 +00:00
Matthias Braun bbbf5d4286 TableGen: Adapt to llvm r288612
llvm-svn: 288614
2016-12-04 05:55:09 +00:00
George Burgess IV 8a36ace5b1 [TableGen] Ignore fake args for parsing-related arg counts.
We should complain about the following:

```
void foo() __attribute__((unavailable("a", "b")));
```

Instead, we currently just ignore "b". (...We also end up ignoring "a",
because we assume elsewhere that this attribute can only have 1 or 0
args.)

This happens because `unavailable` has a fake enum arg, and
`AttributeList::{getMinArgs,getMaxArgs}` include fake args in their
counts.

llvm-svn: 288388
2016-12-01 17:52:39 +00:00
George Burgess IV 1881a573e9 [TableGen] Minor clean-ups. NFC.
Primarily: try to use DenseSet<StringRef> instead of
std::set<std::string>, and use pretty range algos where we can.

Small sizes were arbitrarily chosen.

llvm-svn: 288297
2016-12-01 00:13:18 +00:00
Eugene Zelenko 58ab22fe48 Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288213
2016-11-29 22:44:24 +00:00
Reid Kleckner 6432d45f7b Use noexcept instead of LLVM_NOEXCEPT now that all compilers support it
llvm-svn: 284667
2016-10-19 23:39:55 +00:00
Manuel Klimek a5cf51f2dc 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.

llvm-svn: 283864
2016-10-11 09:25:34 +00:00
Mehdi Amini 732afdd09a 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

llvm-svn: 283671
2016-10-08 19:41:06 +00:00
Manuel Klimek e6d01e08c6 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

llvm-svn: 282573
2016-09-28 10:20:10 +00:00
Devin Coughlin 0dfc6f0809 [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

llvm-svn: 281880
2016-09-19 01:36:40 +00:00
Richard Smith 8cba29181b [docs] Order diagnostic cross-references alphabetically rather than based on
order in the .td file.

llvm-svn: 281434
2016-09-14 01:55:42 +00:00
Richard Smith ce9d586fdb Update DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups in a deterministic order.
llvm-svn: 281433
2016-09-14 01:51:10 +00:00
Reid Kleckner 003bb09e78 Fix a FIXME about MSVC 2013 in the diagnostic doc generation code
Ultimately it boiled down to adding a move constructor.

llvm-svn: 281408
2016-09-13 22:22:56 +00:00
Richard Smith 85edca95c6 Work around MSVC 2013's inability to default move special members.
llvm-svn: 281382
2016-09-13 20:00:02 +00:00
Richard Smith ffa0241a03 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).

llvm-svn: 281363
2016-09-13 18:35:34 +00:00
Richard Smith 67462ffce9 Add virtual destructor (necessary due to the switch to shared_ptr).
llvm-svn: 281198
2016-09-12 06:51:11 +00:00
Richard Smith 94a2fe5c8d Attempt #3 to placate MSVC.
llvm-svn: 281197
2016-09-12 06:38:31 +00:00
Richard Smith c14994f290 Attempt #2 to placate MSVC
llvm-svn: 281195
2016-09-12 06:23:26 +00:00
Richard Smith cd608d1a20 Attempt to placate MSVC.
llvm-svn: 281194
2016-09-12 06:13:44 +00:00
Richard Smith b6a3b4ba61 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.

llvm-svn: 281192
2016-09-12 05:58:29 +00:00
Akira Hatanaka 3d17313734 [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

llvm-svn: 281132
2016-09-10 03:29:43 +00:00
Nico Weber 20e08048ec 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

llvm-svn: 280575
2016-09-03 02:55:10 +00:00
Eric Fiselier 341e825eae 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

llvm-svn: 280525
2016-09-02 18:53:31 +00:00
Eric Fiselier bcdcbd11ba Revert r280516 since it contained accidental changes.
llvm-svn: 280521
2016-09-02 18:43:25 +00:00
Eric Fiselier 92f8935e63 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

llvm-svn: 280516
2016-09-02 18:25:29 +00:00
Chris Bieneman 7f5884a489 [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.

llvm-svn: 279673
2016-08-24 22:09:46 +00:00
Vedant Kumar 957d7a00bc [clang-tblgen] Remove unused #include (NFC)
llvm-svn: 277885
2016-08-05 22:48:53 +00:00
Chris Bieneman 54e044736f 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.

llvm-svn: 277492
2016-08-02 18:23:56 +00:00
Chris Bieneman f7a024b886 [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.

llvm-svn: 277487
2016-08-02 17:50:53 +00:00
Chris Bieneman 973781bbb4 [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.

llvm-svn: 277401
2016-08-01 22:54:00 +00:00
Chris Bieneman 7256f51b18 [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.

llvm-svn: 277234
2016-07-29 22:48:17 +00:00
Mehdi Amini 9670f847b8 [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

llvm-svn: 275882
2016-07-18 19:02:11 +00:00
Saleem Abdulrasool 511f2e5a89 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.

llvm-svn: 275610
2016-07-15 20:41:10 +00:00
Richard Smith 6e2a64f289 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.

llvm-svn: 273913
2016-06-27 19:43:46 +00:00
David Majnemer f7e3609f77 Use ranges to concisely express iteration
No functional change is intended, this should just clean things up a
little.

llvm-svn: 273522
2016-06-23 00:15:04 +00:00
Vedant Kumar 3dd0fb3e70 [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.

llvm-svn: 272695
2016-06-14 19:06:48 +00:00
Vedant Kumar d6d4b3717e Remove stray semi-colon in *.py file, NFC
llvm-svn: 272610
2016-06-14 01:14:50 +00:00
Mike Spertus 27c72d2fdb 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

llvm-svn: 272531
2016-06-13 04:02:35 +00:00
Mike Spertus ce334cf156 Visual Studio Visualizer for PackExpansionType
llvm-svn: 272522
2016-06-12 22:54:46 +00:00
Mike Spertus 47f4890bc1 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.

llvm-svn: 272521
2016-06-12 22:21:56 +00:00
Mike Spertus 5bf7fd8185 Rudimentary support for Visual Studio Stmt visualizer
Better than nothing...

llvm-svn: 272518
2016-06-12 18:42:04 +00:00
Mike Spertus 897711f018 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

llvm-svn: 272487
2016-06-11 20:15:19 +00:00
Mike Spertus 334aa07915 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}

llvm-svn: 272448
2016-06-11 03:02:33 +00:00
Mike Spertus 3f19966441 Added missing close brace to OpaquePtr Visual Studio visualizer
This syntax error resulted in garbage being appended to OpaquePtr visualizations

llvm-svn: 272441
2016-06-10 22:25:43 +00:00