Commit Graph

2117 Commits

Author SHA1 Message Date
Ted Kremenek 6cae9ec643 Add back -Wduplicate-enum which I mistakenly removed.
This was removed with -Wunique-enum, which is still removed.  The
corresponding thread on cfe-comments for that warning is here:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html

If we get specific user feedback for -Wduplicate-enum we can evaluate
whether or not to keep it.

llvm-svn: 170974
2012-12-22 01:34:09 +00:00
Dmitri Gribenko c55c6fc6e3 Fix PR14591: Windows newlines in doxygen comments cause failed assertion in
TextDiagnostic

Patch by Janusz Chorko.

llvm-svn: 170566
2012-12-19 17:34:55 +00:00
Bill Wendling f1c3191188 Add tests to check recent changes to some builtins.
llvm-svn: 170458
2012-12-18 21:09:25 +00:00
Anders Carlsson 2a45e409a8 When warning about a missing prototype because a function declaration is missing 'void', insert a fixit to add the void.
llvm-svn: 170399
2012-12-18 01:29:20 +00:00
Rafael Espindola 7581f3269a Fix isThisDeclarationADefinition for extern following tentative.
An extern declaration following a tentative definition should not itself be
considered a tentative definition.
Fixes pr14614.

llvm-svn: 170377
2012-12-17 22:23:47 +00:00
Chad Rosier 61b2f2bc9e [ms-inline asm] Test case for r170037.
llvm-svn: 170038
2012-12-12 22:46:23 +00:00
Chad Rosier c8e56e8931 [driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag.
rdar://12808010

llvm-svn: 169422
2012-12-05 21:08:21 +00:00
Rafael Espindola 8778c28022 Merge function types in C.
Among other differences, GCC accepts

  typedef int IA[];
  typedef int A10[10];
  static A10 *f(void);
  static IA  *f(void);
  void g(void) {
    (void)sizeof(*f());
  }

but clang used to reject it with:

  invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []')

The intention of c99's 6.2.7 seems to be that we should use the composite type
and accept as gcc does.

Doing the type merging required some extra fixes:
  * Use the type from the function type in initializations, even if an parameter
    is available.
  * Fix the merging of the noreturn attribute in function types.
  * Make CodeGen  handle the fact that an parameter type can be different from
    the corresponding type in the function type.

llvm-svn: 168895
2012-11-29 16:09:03 +00:00
Richard Smith e6a56db2e6 Reject uses of __int128 on platforms that don't support it. Also move the ugly
'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be
properly cleaned up.

llvm-svn: 168856
2012-11-29 05:41:51 +00:00
Eli Friedman 6fdc1221c7 Test for r168674.
llvm-svn: 168675
2012-11-27 02:58:49 +00:00
Rafael Espindola 9c235640e1 Add a testcase that r168411 would break.
llvm-svn: 168669
2012-11-27 01:56:54 +00:00
Rafael Espindola 53192e7d93 Check that we don't warn on this testcase. This is basically a test that
Decl::isUsed checks the attribute. If the function had a body just the check
is DeclMustBeEmitted would be sufficient.

llvm-svn: 168514
2012-11-23 13:54:40 +00:00
NAKAMURA Takumi 3424550294 clang/test/Sema/warn-documentation.cpp: Try to fix up the testcase in r168277.
llvm-svn: 168278
2012-11-18 02:34:33 +00:00
Dmitri Gribenko 76b91c3431 Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.
We actually used to assert on this.

Thanks to NAKAMURA Takumi for noticing this!

llvm-svn: 168277
2012-11-18 00:30:31 +00:00
Andy Gibbs a8df57a962 Made the "expected string literal" diagnostic more expressive
llvm-svn: 168267
2012-11-17 19:16:52 +00:00
Eli Friedman 6745c3b732 Fix a trivial bool-related bug I spotted while skimming David Fang's
current list of powerpc-darwin8 failures.

llvm-svn: 168016
2012-11-15 01:21:59 +00:00
David Blaikie 8fab8e53fb Correct printing of nested anonymous type member accesses.
Patch by Florent Bruneau!

llvm-svn: 167736
2012-11-12 19:12:12 +00:00
Benjamin Kramer d0b9f090fb Set TLSSupported to false on Haiku.
Haiku does not support this (yet). Leaving it set to true leads to
configure scripts detecting __thread being available and Clang emitting
code for it, resulting in binaries the runtime_loader will refuse to
load.

Patch by Jonathan Schleifer!

llvm-svn: 167576
2012-11-08 12:59:15 +00:00
Dmitri Gribenko 5ac744e006 Handle CK_NullToPointer casts in -Wtype-safety properly. Fixes PR14249.
llvm-svn: 167358
2012-11-03 16:07:49 +00:00
Eli Friedman 8f88f06dd2 Tweak wording and add diagnostic groups to misc diagnostics.
llvm-svn: 167274
2012-11-02 01:40:23 +00:00
Quentin Colombet 4e172067b2 Update the front end to use minsize attribute
llvm-svn: 167266
2012-11-01 23:55:47 +00:00
Chad Rosier 0130f82ccc [ms-inline asm] Add test case for r166792.
llvm-svn: 166793
2012-10-26 18:33:59 +00:00
David Tweed 89206b6214 These tests require an actual x86 registered target, so mark them as such. Tested on ARM.
Patch by Joey Gouly.

llvm-svn: 166765
2012-10-26 10:17:44 +00:00
Bill Wendling 208f61913d Fix grammar-o.
llvm-svn: 166759
2012-10-26 07:02:46 +00:00
Eli Friedman 82dc260385 Add an additional test for namespaces and -Wmissing-variable-declarations. Move C++ test into SemaCXX.
llvm-svn: 166616
2012-10-24 20:14:09 +00:00
Matt Beaumont-Gay 53e767bf6b Address feedback from Eli Friedman on r166522.
In particular, we do want to warn on some unused cast subexpressions within
macros.

llvm-svn: 166534
2012-10-24 01:14:28 +00:00
Matt Beaumont-Gay 493d6d55ba Don't emit -Wunused-value warnings from macro expansions.
llvm-svn: 166522
2012-10-23 23:19:32 +00:00
Eli Friedman 4e2e13edb7 Delete junk that snuck into r166498.
llvm-svn: 166499
2012-10-23 20:23:23 +00:00
Eli Friedman 7d14b3c9b3 Add a new warning -Wmissing-variable-declarations, to warn about variables
defined without a previous declaration.  This is similar to
-Wmissing-prototypes, but for variables instead of functions.

Patch by Ed Schouten.

llvm-svn: 166498
2012-10-23 20:19:32 +00:00
Eli Friedman d5d136be5b [ms-inline-asm] Add handling for errors coming out of the backend.
llvm-svn: 166463
2012-10-23 02:43:30 +00:00
David Blaikie 82d3ab9225 Clarify wording of -Wshift-op-parentheses.
Suggestion from Matt Beaumont-Gay reviewing r165283.

llvm-svn: 166296
2012-10-19 18:26:06 +00:00
Andy Gibbs c6e68daac0 Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.
llvm-svn: 166280
2012-10-19 12:44:48 +00:00
Andy Gibbs ac51de6ec2 Fix directive parsing in VerifyDiagnosticConsumer so that it ensures that "expected" is at the start of the word and will no longer accept typos such as "junkexpected-*" as a valid "expected-*" directive. A very few test-cases had to be amended to adhere to the new rule.
Patch reviewed by David Blaikie.

llvm-svn: 166279
2012-10-19 12:36:49 +00:00
Derek Schuff a202096dc0 Add pnaclcall convention to Native Client targets.
Because PNaCl bitcode must be target-independent, it uses some
different bitcode representations from other targets (e.g. byval and
sret for structures). This means that without additional type
information, it cannot meet some native ABI requirements for some
targets (e.g. passing structures containing unions by value on
x86-64). To allow generation of code which uses the correct native
ABIs, we also support triples such as x86_64-nacl, which uses
target-dependent IR (as opposed to le32-nacl, which uses byval and
sret).

To allow interoperation between the two types of code, this patch adds
a calling convention attribute to be used in code compiled with the
target-dependent triple, which will generate code using the le32-style
bitcode. This calling convention does not need to be explicitly
supported in the backend because it determines bitcode representation
rather than native conventions (the backend just needs to undersand
how to handle byval and sret for the Native Client OS).

This patch implements __attribute__((pnaclcall)) to generate calls in
bitcode according to the le32 bitcode conventions, an attribute which
is accepted by any Native Client target, but issues a warning
otherwise.

llvm-svn: 166065
2012-10-16 22:30:41 +00:00
David Blaikie 282ad876bd Implement GCC's -Wint-to-pointer-cast.
This implementation doesn't warn on anything that GCC doesn't warn on with the
exception of templates specializations (GCC doesn't warn, Clang does). The
specific skipped cases (boolean, constant expressions, enums) are open for
debate/adjustment if anyone wants to demonstrate that GCC is being overly
conservative here. The only really obvious false positive I found was in the
Clang regression suite's MPI test - apparently MPI uses specific flag values in
pointer constants. (eg: #define FOO (void*)~0)

llvm-svn: 166039
2012-10-16 18:53:14 +00:00
Eli Friedman 9ee2d04753 Make -mms-bitfields behave consistently.
Patch by Jeremiah Zanin.

llvm-svn: 165849
2012-10-12 23:29:20 +00:00
Logan Chien 57086ce248 Fix PR 11709: Change the definition of va_list to meet AAPCS requirement
AAPCS ABI Section 7.1.4 [1] specifies that va_list
should be defined as struct __va_list { void *__ap;};
And in C++, it is defined in namespace std.

[1] http://infocenter.arm.com/help/topic
         /com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf

Patch by Weiming Zhao.

llvm-svn: 165609
2012-10-10 06:56:20 +00:00
Eli Friedman ae8ee25d8d Make sure we allow "#pragma options align=mac68k" in function-local contexts. <rdar://problem/12453134>
llvm-svn: 165462
2012-10-08 23:52:38 +00:00
David Blaikie dac86fd24c Use a single note diagnostic for all the precedent/parentheses warnings.
llvm-svn: 165384
2012-10-08 01:19:49 +00:00
Benjamin Kramer a801f4a81d Expose __builtin_bswap16.
GCC has always supported this on PowerPC and 4.8 supports it on all platforms,
so it's a good idea to expose it in clang too. LLVM supports this on all targets.

llvm-svn: 165362
2012-10-06 14:42:22 +00:00
Aaron Ballman 57f590e674 Changing line endings from Windows to Unix. No functional changes.
llvm-svn: 165329
2012-10-05 19:46:32 +00:00
David Blaikie 15f17cbbd8 Implement -Wshift-op-parentheses for: a << b + c
This appears to be consistent with GCC's implementation of the same warning
under -Wparentheses. Suppressing a << b + c for cases where 'a' is a user
defined type for compatibility with C++ stream IO. Otherwise suggest
parentheses around the addition or subtraction subexpression.

(this came up when MSVC was complaining (incorrectly, so far as I can tell)
about a perceived violation of this within the LLVM codebase, PR14001)

llvm-svn: 165283
2012-10-05 00:41:03 +00:00
Eli Friedman 68be1649ee Permanently end the whole "pragma got handled by the parser too early"
mess by handling all pragmas which the parser touches uniformly.
<rdar://problem/12248901>, etc.

llvm-svn: 165195
2012-10-04 02:36:51 +00:00
Aaron Ballman a99c35702d Splitting this test case into two because the behavior for the calling convention code is target-specific.
llvm-svn: 165016
2012-10-02 14:56:00 +00:00
Aaron Ballman e91c6be01e Allowing individual targets to determine whether a given calling convention is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs.
Fixes PR13782

llvm-svn: 165015
2012-10-02 14:26:08 +00:00
Fariborz Jahanian c491c3f27a availability in structured documents. Takes
care of comments by Dimitri and Doug.

llvm-svn: 164957
2012-10-01 18:42:25 +00:00
Dmitri Gribenko 6743e04699 Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.

llvm-svn: 164892
2012-09-29 11:40:46 +00:00
Richard Smith 80ac9efec4 Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!
llvm-svn: 164841
2012-09-28 20:20:52 +00:00
Nico Weber f666b2a547 Make this test actually test something
llvm-svn: 164677
2012-09-26 09:02:07 +00:00
Hans Wennborg c980408c71 Fix failing test/Sema/wchar.c on ARM.
Currently Sema/wchar.c fails because WCHAR_T_TYPE is defined as int,
however on ARM wchar_t is unsigned int.

This patch changes that, so this test passes for ARM.

Patch by Joey Gouly!

llvm-svn: 164598
2012-09-25 10:11:17 +00:00
Bob Wilson 317be45091 Replace an assertion with an error for empty __asm statements.
llvm-svn: 164551
2012-09-24 19:57:59 +00:00
Dmitri Gribenko 1cd2305703 Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.

llvm-svn: 164545
2012-09-24 18:19:21 +00:00
Dmitri Gribenko 1da8886915 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.

llvm-svn: 164467
2012-09-22 21:47:50 +00:00
Abramo Bagnara 6cba23a649 Avoid multiple atomic builtin declaration.
llvm-svn: 164454
2012-09-22 09:05:22 +00:00
Fariborz Jahanian 2f4e33aba2 Improvements to my patch in r164143 per
Richard's comments. // rdar://12202422

llvm-svn: 164316
2012-09-20 19:36:41 +00:00
David Blaikie 6590220181 Include types when a definition's type differs from a prior declaration.
This is some really old code (took me a while to find the test cases) & the
diagnostic text is slightly incorrect (it should really only apply to
re/declarations/, redefinitions are an error regardless of whether the types
match). Not sure if anyone cares about it, though.

For now this just makes the diagnostic more clear in less obvious cases where
the type of a declaration might not be explicitly written (eg: because it
uses decltype)

llvm-svn: 164313
2012-09-20 18:38:57 +00:00
Richard Smith b6d516e7bd PR13881: Add -Wzero-length-array for zero length array extension, and move it into -Wgnu.
llvm-svn: 164272
2012-09-20 01:02:05 +00:00
Fariborz Jahanian b1885425c4 c: warn when an integer value comparison with an
integral expression have the obvious result.
Patch reviewed by John McCall off line.
// rdar://12202422

llvm-svn: 164143
2012-09-18 17:37:21 +00:00
Ted Kremenek 97c5a1e735 Per discussion on cfe-dev, remove -Wunique-enums entirely. There
is no compelling argument that this is a generally useful warning,
and imposes a strong stylistic argument on code beyond what it was
intended to find warnings in.

llvm-svn: 164083
2012-09-18 00:41:42 +00:00
Dmitri Gribenko 49fdf8d3f5 Comment parsing: don't treat typedef to a typedef to a function as a
'function-like' type that can be annotated with \param.

Thanks to Eli Friedman for noticing!

llvm-svn: 163985
2012-09-15 21:13:36 +00:00
Richard Smith e00921a0a4 const _Atomic(T) is not an atomic type, so do not allow it as the type 'A' in
C11 7.17's atomic operations. GNU's __atomic_* builtins do allow const-qualified
atomics, though (!!) so don't restrict those.

llvm-svn: 163964
2012-09-15 06:09:58 +00:00
Dmitri Gribenko 578865b73c Comment parsing: support the "\invariant" command.
llvm-svn: 163905
2012-09-14 15:37:29 +00:00
Dmitri Gribenko b37d5e8a95 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.

llvm-svn: 163836
2012-09-13 20:36:01 +00:00
Jordan Rose 4c266aa371 Format strings: offer a fixit for Darwin's %D/%U/%O to ISO %d/%u/%o.
<rdar://problem/12061922>

llvm-svn: 163772
2012-09-13 02:11:15 +00:00
Jordan Rose 510260c2bf Format strings: %D, %U, and %O are valid on Darwin (same as %d, %u, %o).
These will warn under -Wformat-non-iso, and will still be rejected
outright on other platforms.

<rdar://problem/12061922>

llvm-svn: 163771
2012-09-13 02:11:03 +00:00
NAKAMURA Takumi fcd16e36c8 clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.
I think some of them could be rewritten to fit also LLP64.

llvm-svn: 163699
2012-09-12 10:45:40 +00:00
Ted Kremenek 7979ccf35a Teach -Wuninitialized to recognize __attribute__((analyzer_noreturn))
for halting the propagation of uninitialized value tracking along
a path.  Unlike __attribute__((noreturn)), this attribute (which
is used by clients of the static analyzer) can be used to annotate
functions that essentially never return, but in rare cares may be
allowed to return for (special) debugging purposes.  This attribute
has been shown in reducing false positives in the static analyzer
by pruning false postives, and is equally applicable here.

Handling this attribute in the CFG itself is another option, but
this is not something all clients (e.g., possibly -Wunreachable-code)
would want to see.

Addresses <rdar://problem/12281583>.

llvm-svn: 163681
2012-09-12 05:53:43 +00:00
Dmitri Gribenko 9304d86329 Comment parsing: handle non-builtin commands correctly. After semantic
analysis registers a command, it becomes a "known" command for the lexer, since
it has an ID.  Having this freedom of choice to register a command is a good
thing since BriefParser does not need this.

But the parser should still invoke the correct semantic analysis method
(actOnUnknownCommand) in this case.

llvm-svn: 163646
2012-09-11 19:22:03 +00:00
NAKAMURA Takumi e06bc926bb clang/test/Sema/format-strings-scanf.c: Relax a couple of expressions with expected-warning-re to let matched for Win32 targets.
- format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'
- format specifies type 'wchar_t **' (aka 'unsigned short **') but the argument has type 'float *'

llvm-svn: 163468
2012-09-08 12:06:00 +00:00
Jordan Rose 2f9cc04251 Format strings: suggest %lld instead of %qd and %Ld with -Wformat-non-iso.
As a corollary to the previous commit, even when an extension is
available, we can still offer a fixit to the standard modifier.

llvm-svn: 163453
2012-09-08 04:00:12 +00:00
Jordan Rose 92303592c3 Format strings: %Ld isn't available on Darwin or Windows.
This seems to be a GNU libc extension; we offer a fixit to %lld on
these platforms.

<rdar://problem/11518237>

llvm-svn: 163452
2012-09-08 04:00:03 +00:00
Fariborz Jahanian 66c93f443d c: make __attribute__((unused)) transitive.
Don't warn if annotated decl is used inside another
   unused. // rdar://12233989

llvm-svn: 163329
2012-09-06 16:43:18 +00:00
Fariborz Jahanian aaf376b4dd c error recovery. treat an invalid redeclaration
of a c-function for what it is. Otherwise, this func
is treated as an overloadable c-function resulting in
a crash much later. // rdar://11743706

llvm-svn: 163224
2012-09-05 17:52:12 +00:00
Richard Trieu 73e306e548 Add -Wduplicate-enum warning. Clang will emit this warning when an implicitly
initiated enum constant has the same value as another enum constant.

For instance:
enum test { A, B, C = -1, D, E = 1 };
Clang will warn that:
 A and D both have value 0
 B and E both have value 1

A few exceptions are made to keep the noise down.  Enum constants which are
initialized to another enum constant, or an enum constant plus or minus 1 will
not trigger this warning.  Also, anonymous enums are not checked.

llvm-svn: 162938
2012-08-30 20:32:24 +00:00
Eli Friedman 448ce40426 Fix a crash in type merging with enum types.
llvm-svn: 162886
2012-08-30 00:44:15 +00:00
Hans Wennborg fa4e41f73c Move the test for PR13720 from Sema/init.c to Sema/thread-specifier.c.
Can't use __thread in init.c because it doesn't have a triple.

llvm-svn: 162836
2012-08-29 09:04:10 +00:00
Hans Wennborg 299f50b4e8 The address of a TLS var is not compile-time constant (PR13720)
This makes Clang produce an error for code such as:

  __thread int x;
  int *p = &x;

The lvalue of a thread-local variable cannot be evaluated at compile
time.

llvm-svn: 162835
2012-08-29 08:44:49 +00:00
Rafael Espindola 3dd531dbd4 Fix for assertion when solving unresolved templates.
Patch by Magee, Josh.

llvm-svn: 162737
2012-08-28 04:13:54 +00:00
Dmitri Gribenko 219bd1554f Comment diagnostics: for unresolved parameters, do not suggest parameter fixit
with parameter that is documented.

Fixes PR13670, <rdar://problem/12155840>.

llvm-svn: 162570
2012-08-24 17:45:39 +00:00
Ted Kremenek 64fea5fc8f Teach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.
Fixes <rdar://problem/11005770>.

llvm-svn: 162545
2012-08-24 07:42:09 +00:00
Dmitri Gribenko 907f6b8c06 Comment semantic analysis: treat function typedefs as functions so that one can
use \param and \returns in documentation.

Fixes PR13533.

llvm-svn: 162507
2012-08-24 00:05:30 +00:00
Dmitri Gribenko 107618a6cb Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tag
name.  This should reduce the amount of warning false positives about bad HTML
in comments when the comment author intended to put a reference to a template.
This change will also enable us parse the comment as intended in these cases.

Fixes part 1 of PR13374.

llvm-svn: 162407
2012-08-22 22:56:08 +00:00
Fariborz Jahanian f85f338634 c: privide deprecated warning when __private_extern__ storage
specifier is unsed in a declaration; as it may not make the symbol
local to linkage unit as intended. Suggest using "hidden" visibility 
attribute instead. // rdar://7703982

llvm-svn: 162138
2012-08-17 21:44:55 +00:00
Fariborz Jahanian 3a4b644982 make this test case 64bit test. It fails due to
'int' vs. 'long' issue with i386.

llvm-svn: 162125
2012-08-17 20:23:06 +00:00
Fariborz Jahanian 91f548b04b c: implement gcc's -Wbad-function-cast which warns
on unsafe cast of a c-function call. This is
a C-only option.

llvm-svn: 162109
2012-08-17 17:22:34 +00:00
Benjamin Kramer 0e72d5c3e5 Define __builtin_ffs[ll] with a signed argument instead of unsigned.
GCC documents these as unsigned, but defines them as signed.

llvm-svn: 162106
2012-08-17 16:39:13 +00:00
Dmitri Gribenko e4a5a90e8d Add support for "type safety" attributes that allow checking that 'void *'
function arguments and arguments for variadic functions are of a particular
type which is determined by some other argument to the same function call.

Usecases include:
* MPI library implementations, where these attributes enable checking that
  buffer type matches the passed MPI_Datatype;
* for HDF5 library there is a similar usecase as MPI;
* checking types of variadic functions' arguments for functions like
  fcntl() and ioctl().

llvm-svn: 162067
2012-08-17 00:08:38 +00:00
Eric Christopher 9e49188a01 Add a missing 'break' to ensure that we reject inline assembly
constraints we don't recognize.

llvm-svn: 162064
2012-08-16 23:50:41 +00:00
Dmitri Gribenko 4ae66a31fe Attaching comments to declarations: parse the comment in context of the
declaration it was attached to.

llvm-svn: 162033
2012-08-16 18:19:43 +00:00
Matt Beaumont-Gay 22be8d5ab8 Allow 'static' and type qualifiers in K&R parameter type lists.
llvm-svn: 161980
2012-08-15 19:53:19 +00:00
Fariborz Jahanian 05f4e7181a Patch to warn about __private_extern__ on tentative definitions
as it does something unexpected (but gcc compatible).
Suggest use of __attribute__((visibility("hidden")))
on declaration instead. // rdar://7703982

llvm-svn: 161972
2012-08-15 18:42:26 +00:00
Hans Wennborg 420052640f Check for improper use of 'static' and type qualifiers in array
declarators.

They are only allowed for function parameters, and then only on the
outermost array type derivation.

llvm-svn: 161934
2012-08-15 07:42:30 +00:00
Dmitri Gribenko b261088a61 Attaching comments to redeclarations: fix wrong assumptions
The reason for the recent fallout for "attaching comments to any redeclaration"
change are two false assumptions:
(1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y'
    where we want the comment to be attached to both X and Y);
(2) the whole redeclaration chain has only a single comment (obviously false, the
    user can put a separate comment for each redeclaration).

To fix (1) I revert the part of the recent change where a 'Decl*' member was
introduced to RawComment.  Now ASTContext has a separate DenseMap for mapping
'Decl*' to 'FullComment*'.

To fix (2) I just removed the test with this assumption.  We might not parse
every comment in redecl chain if we already parsed at least one.

llvm-svn: 161878
2012-08-14 17:17:18 +00:00
Benjamin Kramer 833fb9f7e3 Fix horribly broken sema of __attribute__((pcs())).
llvm-svn: 161863
2012-08-14 13:13:47 +00:00
Fariborz Jahanian 7513fa346c c: small refactoring of checking for __attribute__(const))
per Richard's comment.

llvm-svn: 161786
2012-08-13 21:15:02 +00:00
Fariborz Jahanian 794ae1ea77 c: make __has_attribute(const) work for const
function attribute. // rdar://10253857

llvm-svn: 161767
2012-08-13 18:04:58 +00:00
Douglas Gregor 35ceb27fa4 When looking for the comment associated with a declaration, adjust the
'templated' declaration for a function or class template to refer to
the function or class template itself, to which the documentation will
be attached. Fixes PR13593.

llvm-svn: 161762
2012-08-13 16:37:30 +00:00
Eli Friedman 89b1f2c7e1 Handle deprecation diagnostics correctly for C struct fields and Objective-C properties/ivars. <rdar://problem/6642337>.
llvm-svn: 161534
2012-08-08 23:04:35 +00:00
Eli Friedman 971bfa11c6 Unify the codepaths for emitting deprecation warnings. The test changes are just to account for us emitting notes more consistently.
llvm-svn: 161528
2012-08-08 21:52:41 +00:00
Anna Zaks 13b0857ad0 Address code review comments for Wstrncat-size warning (r161440).
llvm-svn: 161527
2012-08-08 21:42:23 +00:00