Граф коммитов

70 Коммитов

Автор SHA1 Сообщение Дата
Argyrios Kyrtzidis 350aea7b79 [PCH] Reading expressions from attributes should be done using ReadExpr(),
not ReadExpr().

Also add a test case making sure the thread safety attributes work as expected
when they come from a PCH.

Fixes rdar://12584141 & http://llvm.org/PR13982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168017 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-15 01:31:39 +00:00
Joerg Sonnenberger 6b2b8977bc Don't require exception handling for clang-tblgen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166713 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 20:34:00 +00:00
Joerg Sonnenberger 38859ee4a3 Don't throw exceptions in clang-tblgen by switching to PrintFatalError.
Add locations in a number of places, where they are available for free.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-25 16:37:08 +00:00
Michael J. Spencer c635710bcb [Options] Add prefixes to options.
Each option has a set of prefixes. When matching an argument such as
-funroll-loops. First the leading - is removed as it is a prefix. Then
a lower_bound search for "funroll-loops" is done against the option table by
option name. From there each option prefix + option name combination is tested
against the argument.

This allows us to support Microsoft style options where both / and - are valid
prefixes. It also simplifies the cases we already have where options come in
both - and -- forms. Almost every option for gnu-ld happens to have this form.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-22 22:13:48 +00:00
Sean Silva b43d87b064 Remove pointless classof()'s.
Updates to llvm/Support/Casting.h have rendered these classof()'s
irrelevant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165770 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11 23:31:23 +00:00
Sean Silva dbd9197574 tblgen: Build clang-tblgen without RTTI.
clang-tblgen no longer needs RTTI!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 20:25:45 +00:00
Sean Silva 1ab4632308 tblgen: Use LLVM-style RTTI in clang-tblgen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165649 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10 20:25:43 +00:00
Sean Silva de3832b123 tblgen: Migrate clang-tblgen to new TableGenMain API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165167 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 21:29:30 +00:00
Dmitri Gribenko 0bd9838751 Comment sema: warn when comment has \deprecated but declaration does not have a
deprecation attribute ('deprecated', 'availability' or 'unavailable').

This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it
can be turned off easily while leaving other -Wdocumentation warnings on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164467 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-22 21:47:50 +00:00
Dmitri Gribenko abcf0dccc9 Comment parsing: handle \deprecated command. It is a block command, but it
should be fine to use it without further explanations in the attached
paragraph, so the warning about empty paragraph was turned off for it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-13 20:36:01 +00:00
Dmitri Gribenko e4330a302a Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.
Now we have a list of all commands.  This is a good thing in itself, but it
also enables us to easily implement typo correction for command names.

With this change we have objects that contain information about each command,
so it makes sense to resolve command name just once during lexing (currently we
store command names as strings and do a linear search every time some property
value is needed).  Thus comment token and AST nodes were changed to contain a
command ID -- index into a tables of builtin and registered commands.  Unknown
commands are registered during parsing and thus are also uniformly assigned an
ID.  Using an ID instead of a StringRef is also a nice memory optimization
since ID is a small integer that fits into a common bitfield in Comment class.

This change implies that to get any information about a command (even a command
name) we need a CommandTraits object to resolve the command ID to CommandInfo*.
Currently a fresh temporary CommandTraits object is created whenever it is
needed since it does not have any state.  But with this change it has state --
new commands can be registered, so a CommandTraits object was added to
ASTContext.

Also, in libclang CXComment has to be expanded to include a CXTranslationUnit
so that all functions working on comment AST nodes can get a CommandTraits
object.  This breaks binary compatibility of CXComment APIs.

Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't
need TU parameter anymore, so it was removed.  This is a source-incompatible
change for this C API.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163540 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 20:32:42 +00:00
Roman Divacky 31ba613537 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 15:59:27 +00:00
Dmitri Gribenko c24a76e376 Comment HTML tag name machers: move from StringSwitch to an efficient
TableGen-generated string matcher.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162969 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 02:21:44 +00:00
Richard Smith 0dae729a69 Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162007 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16 02:43:29 +00:00
Richard Smith b27660a733 Placate the mingw32 buildbot by suffixing 64-bit constants with ULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161831 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14 03:55:16 +00:00
Richard Smith f8ee6bc1ef Fix undefined behavior (and wrong code, as far as I can tell) in NEON builtin
tablegen code, found by -fcatch-undefined-behavior. I would appreciate if
someone more familiar with the NEON code could point me in the direction of how
to write a test for this. We appear to have essentially no test coverage
whatsoever for these builtins.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161827 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-14 01:28:02 +00:00
Ted Kremenek bb5185c0ca Fix horrible regression in control of warnings caused by introduction of -Wpedantic.
While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that
are on by default.  This counters the intention of this warning flag.

To fix this, -Wpedantic now includes extentions that are not on by default.  The
remaining warnings will manifest anyway, and won't accidentally get turned off
by -Wno-pedantic.

Fixes <rdar://problem/12076105>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161695 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 20:50:00 +00:00
Joerg Sonnenberger 7094dee95f Add missing cctype includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161660 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 10:58:18 +00:00
Ted Kremenek 4a535368eb Enhance ClangDiagnosticsEmitter to reject diagnostics that are errors that are also
included in warning groups.  Warning groups can only contain warnings, because only
warnings can be mapped to errors or ignored.

This caught a few diagnostics that were incorrectly in diagnostic groups, and
could have resulted in a compiler crash when those diagnostic groups were mapped.

Fixes <rdar://problem/12044436>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161389 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-07 05:01:49 +00:00
Jim Grosbach 66981c7ca1 TableGen: Remove extraneous \ character from arm_neon.h definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161244 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 17:30:46 +00:00
Michael Han cc4748a0cb Remove an unused header
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 04:10:19 +00:00
Ted Kremenek e8cf7d1434 Re-apply r159875 with fixes.
- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159892 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 05:53:30 +00:00
NAKAMURA Takumi 3b4c532596 Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.
I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 02:48:02 +00:00
Ted Kremenek 25570a94ca Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159875 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 23:07:31 +00:00
Dmitri Gribenko 8d3ba23f2d Implement AST classes for comments, a real parser for Doxygen comments and a
very simple semantic analysis that just builds the AST; minor changes for lexer
to pick up source locations I didn't think about before.

Comments AST is modelled along the ideas of HTML AST: block and inline content.

* Block content is a paragraph or a command that has a paragraph as an argument
  or verbatim command.
* Inline content is placed within some block.  Inline content includes plain
  text, inline commands and HTML as tag soup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159790 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:28:32 +00:00
NAKAMURA Takumi 41de13b3b6 clang/utils/TableGen/ClangAttrEmitter.cpp: Fix abuse of StringRef (from getValueAsString()).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 14:45:09 +00:00
Sean Hunt 8571897a79 Fix a thinko and a stray debugging hunk in my attributes patch. Thanks to Jordan
Rose and Richard Smith for catching these.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158826 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-20 16:05:42 +00:00
Sean Hunt 8e083e71d4 Reapply r158700 and fixup patches, minus one hunk that slipped through and
caused a crash in an obscure case. On the plus side, it caused me to catch
another bug by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158767 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 23:57:03 +00:00
Jakob Stoklund Olesen 3532936f4f Revert r158700 and dependent patches r158716, r158717, and r158731.
The original r158700 caused crashes in the gcc test suite,
g++.abi/vtable3a.C among others. It also caused failures in the libc++
test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158749 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 21:48:43 +00:00
Sean Hunt b5aa17c5a1 Remove redundant uses of SmallString
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 18:12:18 +00:00
Sean Hunt c20c4e79ae Stop abusing StringRef. Fixes the Windows build.
I've also removed the duplicate check for PARSED_ATTR since it seems
unnecessary, and would have made the code more complicated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158716 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 13:36:02 +00:00
Sean Hunt bfcb037a34 Improve the specification of spellings in Attr.td.
Note that this is mostly a structural patch that handles the change from the old
spelling style to the new one. One consequence of this is that all AT_foo_bar
enum values have changed to not be based off of the first spelling, but rather
off of the class name, so they are now AT_FooBar and the like (a straw poll on
IRC showed support for this). Apologies for code churn.

Most attributes have GNU spellings as a temporary solution until everything else
is sorted out (such as a Keyword spelling, which I intend to add if someone else
doesn't beat me to it). This is definitely a WIP.

I've also killed BaseCheckAttr since it was unused, and I had to go through
every attribute anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-19 03:39:03 +00:00
Sean Hunt 93f95f2a2c Handle C++11 attribute namespaces automatically.
Now, as long as the 'Namespaces' variable is correct inside Attr.td, the
generated code will correctly admit a C++11 attribute only when it has the
appropriate namespace(s).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158661 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-18 16:13:52 +00:00
Jakob Stoklund Olesen 3cc509b5ac Make clang-tblgen backends functions instead of TableGenBackends.
Get rid of a bunch of header files. TableGen output should be unaffected.

Patch by Sean Silva!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158388 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-13 05:12:41 +00:00
Jim Grosbach b4a542549c TableGen: Remove extraneous '\' at EOL in generated tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 18:18:29 +00:00
Rafael Espindola 31c195ac0f Fix our handling of visibility in explicit template instantiations.
* Don't copy the visibility attribute during instantiations. We have to be able
  to distinguish

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template DEFAULT void bar<foo>();

from

 struct HIDDEN foo {};
 template<class T>
 DEFAULT void bar() {}
 template void bar<foo>();

* If an instantiation has an attribute, it takes precedence over an attribute
  in the template.

* With instantiation attributes handled with the above logic, we can now
  select the minimum visibility when looking at template arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156821 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-15 14:09:55 +00:00
Douglas Gregor 703d412d19 Teach the parser to deal with multiple spellings for the same
attribute, rather than requiring multiple cases in consumers of this
information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156666 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-11 23:37:49 +00:00
Jim Grosbach 667381b21f ARM: Support marking intrinsic definitions as 'unavailable'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156490 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-09 18:17:30 +00:00
Richard Smith 46484770fe Remove DiagGroups from notes, and add a TableGen assertion to catch them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156192 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-04 19:05:50 +00:00
Douglas Gregor 0c19b3c38e Replace the StringSwitch in AttributeList::getKind() with a
TableGen-generated StringMatcher, for a 1.2% speedup in -fparse-only
time in <rdar://problem/11004361>. Thanks to Benjamin for pointing me
at StringMatcher!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156003 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 17:33:51 +00:00
Douglas Gregor 331d2ec7cd Introduce the notion of 'ignored' attributes, so that all attributes
we accept are not modeled somehow via Attr.td.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155998 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 16:18:45 +00:00
Douglas Gregor 3e7d31aa60 Introduce the notion of an attribute that has no direct representation
as an AST node, and fold a number of such attributes into Attr.td.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155995 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 15:56:52 +00:00
Douglas Gregor d6268ffe94 Revert my optimization to AttributeList::getKind() in r155987;
Benjamin has suggested a better approach.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155989 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 14:50:50 +00:00
Douglas Gregor b6dd6055a4 Replace the StringSwitch in AttributeList::getKind(const
IdentifierInfo *) with a static StringMap, improving -fsyntax-only
performance by 1% for the example in <rdar://problem/11004361>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155987 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-02 14:24:30 +00:00
Michael Han e53ac8aea2 Refactor Clang sema attribute handling.
This submission improves Clang sema handling by using Clang tablegen
to generate common boilerplate code. As a start, it implements AttributeList
enumerator generation and case statements for AttributeList::getKind.

A new field "SemaHandler" is introduced in Attr.td and by default set to 1
as most of attributes in Attr.td have semantic checking in Sema. For a small
number of attributes that don't appear in Sema, the value is set to 0.

Also there are a small number of attributes that only appear in Sema but not
in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList.

Reviewed by Delesley Hutchins.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 00:12:16 +00:00
Argyrios Kyrtzidis d42236e9d5 [tablegen] Make sure that the code that is determining the order of warning groups
is shared to avoid any "misalignment" if indices.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152074 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-06 00:00:38 +00:00
Benjamin Kramer d49cb20288 Store the warning option corresponding to a diagnostics as an index into the option table instead of storing the name.
Another 8 bytes + relocation removed from every diagnostic on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150615 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 20:57:03 +00:00
Dylan Noblesmith 36d592718f drop more llvm:: prefixes on SmallString<>
More cleanup after r149799.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150380 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-13 12:32:26 +00:00
Daniel Dunbar b880609697 Remove stray semi-colon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150231 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-10 06:00:29 +00:00
Benjamin Kramer f94d392847 Kill the brief and full explanation fields from StaticDiagInfoRec. They were unused and wasted space for nothing.
- per PR11952.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150199 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09 19:38:26 +00:00