Commit Graph

35 Commits

Author SHA1 Message Date
Rafael Espindola 7f90b7d4c2 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.

llvm-svn: 156821
2012-05-15 14:09:55 +00:00
Douglas Gregor 87a170c1e6 Teach the parser to deal with multiple spellings for the same
attribute, rather than requiring multiple cases in consumers of this
information.

llvm-svn: 156666
2012-05-11 23:37:49 +00:00
Jim Grosbach 6f855e3024 ARM: Support marking intrinsic definitions as 'unavailable'
llvm-svn: 156490
2012-05-09 18:17:30 +00:00
Richard Smith ce52ca178d Remove DiagGroups from notes, and add a TableGen assertion to catch them.
llvm-svn: 156192
2012-05-04 19:05:50 +00:00
Douglas Gregor 377f99bc68 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!

llvm-svn: 156003
2012-05-02 17:33:51 +00:00
Douglas Gregor 19fbb8fa81 Introduce the notion of 'ignored' attributes, so that all attributes
we accept are not modeled somehow via Attr.td.

llvm-svn: 155998
2012-05-02 16:18:45 +00:00
Douglas Gregor b2daf8416e 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.

llvm-svn: 155995
2012-05-02 15:56:52 +00:00
Douglas Gregor 0191bf8655 Revert my optimization to AttributeList::getKind() in r155987;
Benjamin has suggested a better approach.

llvm-svn: 155989
2012-05-02 14:50:50 +00:00
Douglas Gregor adfe5afe38 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>.

llvm-svn: 155987
2012-05-02 14:24:30 +00:00
Michael Han 4a04517329 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.

llvm-svn: 152169
2012-03-07 00:12:16 +00:00
Argyrios Kyrtzidis 87acf19a5c [tablegen] Make sure that the code that is determining the order of warning groups
is shared to avoid any "misalignment" if indices.

llvm-svn: 152074
2012-03-06 00:00:38 +00:00
Benjamin Kramer a8cafe23e3 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.

llvm-svn: 150615
2012-02-15 20:57:03 +00:00
Dylan Noblesmith f1a13f29f2 drop more llvm:: prefixes on SmallString<>
More cleanup after r149799.

llvm-svn: 150380
2012-02-13 12:32:26 +00:00
Daniel Dunbar dc51baade4 Remove stray semi-colon.
llvm-svn: 150231
2012-02-10 06:00:29 +00:00
Benjamin Kramer 3edb3b4ac5 Kill the brief and full explanation fields from StaticDiagInfoRec. They were unused and wasted space for nothing.
- per PR11952.

llvm-svn: 150199
2012-02-09 19:38:26 +00:00
Benjamin Kramer bf8da9d706 Move instantiateTemplateAttribute into the sema namespace, make helpers static.
llvm-svn: 149864
2012-02-06 11:13:08 +00:00
DeLesley Hutchins 30398dd410 Delayed template instantiation of late-parsed attributes.
llvm-svn: 148595
2012-01-20 22:50:54 +00:00
DeLesley Hutchins ceec3063e2 Instantiate dependent attributes when instantiating templates.
llvm-svn: 148592
2012-01-20 22:37:06 +00:00
David Blaikie 8a40f700e6 Remove unreachable code in Clang. (replace with llvm_unreachable where appropriate or when GCC requires it)
llvm-svn: 148292
2012-01-17 06:56:22 +00:00
David Blaikie f47fa304a4 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Jakob Stoklund Olesen 6f2288b67c CodeInit was replaced by StringInit.
llvm-svn: 148095
2012-01-13 04:57:47 +00:00
Benjamin Kramer 4fde7a8007 Remove unused include of VectorExtras.h.
llvm-svn: 147737
2012-01-07 19:41:22 +00:00
Bob Wilson bd646de67f Relax type checking for a few Neon intrinsics. <rdar://problem/10538555>
Not long ago, I tightened up the type checking for pointer arguments of
Neon intrinsics to match the specifications provided by ARM.  One consequence
was that it became impossible to access the unaligned versions of a few
Neon load/store operations.  Since there are just a few of these intrinsics
where it makes a difference, I think it's better to relax the type checking
than to either introduce new non-standard unaligned intrinsics or to disallow
intrinsics for the unaligned operations.

llvm-svn: 146963
2011-12-20 06:16:48 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Douglas Gregor 49ccfaa938 Add support for pretty-printing attributes, from Richard Membarth!
llvm-svn: 145002
2011-11-19 19:22:57 +00:00
Bob Wilson 89d14247ff Fix Neon builtin pointer argument checking for "sret" builtins.
The code for checking Neon builtin pointer argument types was assuming that
there would only be one pointer argument.  But, for vld2-4 builtins, the first
argument is a special sret pointer where the result will be stored.  So,
instead of scanning all the arguments to find a pointer, have TableGen figure
out the index of the pointer argument that needs checking.  That's better than
scanning all the arguments regardless.  <rdar://problem/10448804>

llvm-svn: 144834
2011-11-16 21:32:23 +00:00
Benjamin Kramer fee467a0d0 Validate DiagGroup names in TableGen, they're used as command line arguments so we don't want shell meta chars in there.
llvm-svn: 144645
2011-11-15 12:54:53 +00:00
Bob Wilson e4d7723b87 Check pointer types for arguments of Neon load/store macros. rdar://9958031
The Neon load/store intrinsics need to be implemented as macros to avoid
hiding alignment attributes on the pointer arguments, and the macros can
only evaluate those pointer arguments once (in case they have side effects),
so it has been hard to get the right type checking for those pointers.
I tried various alternatives in the arm_neon.h header, but it's much more
straightforward to just check directly in Sema.

llvm-svn: 144075
2011-11-08 05:04:11 +00:00
Bob Wilson 98bc98caa8 Clean up type flags for overloaded Neon builtins. No functional change.
This patch just adds a simple NeonTypeFlags class to replace the various
hardcoded constants that had been used until now.  Unfortunately I couldn't
figure out a good way to avoid duplicating that class between clang and
TableGen, but since it's small and rarely changes, that's not so bad.

llvm-svn: 144054
2011-11-08 01:16:11 +00:00
Benjamin Kramer 44f91da8cc Use StringRef's case transformation methods.
llvm-svn: 143889
2011-11-06 20:36:48 +00:00
Chandler Carruth c5d72c103b Update the CMake build for clang-tblgen to reflect that it directly
depends on the Support library rather than relying on TableGen's
transitive dependency.

llvm-svn: 143532
2011-11-02 05:04:43 +00:00
Bob Wilson 3b476aec6d Add __nodebug__ attribute to functions in arm_neon.h
This matches what we do for Intel vector intrinsics. <rdar://problem/10280207>

llvm-svn: 141958
2011-10-14 16:55:33 +00:00
Richard Smith caf3390d44 Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
   and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
   behaviour.
 - Factor out evaluation of bitfield bit widths.
 - Fix a few places which would evaluate an expression twice: once to determine
   whether it is a constant expression, then again to get the value.

llvm-svn: 141561
2011-10-10 18:28:20 +00:00
Peter Collingbourne bf8989fd19 Make clang-tblgen's Makefile independent of Clang's top-level Makefile,
to avoid having to make it available for the cross build when it
builds only clang-tblgen.

llvm-svn: 141453
2011-10-08 00:26:35 +00:00
Peter Collingbourne bee583fd6e Add the Clang tblgen backends to Clang, and flip the switch to cause
the build systems to use clang-tblgen.

llvm-svn: 141291
2011-10-06 13:03:08 +00:00