Commit Graph

1146 Commits

Author SHA1 Message Date
Chad Rosier cc40ea7f9a Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX).  Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size.  Thus, very large vectors will be over-aligned with no 
benefit.  Target owners should set this target max.

llvm-svn: 160209
2012-07-13 23:57:43 +00:00
Richard Trieu a4056004bf Modify tree printing mode for template type diffing. If a diagnostic has
multiple %diff's, only print the first tree and fallback to inline printing
for the rest of the diagnostic.

llvm-svn: 160193
2012-07-13 21:18:32 +00:00
John McCall 775086e67c Add the ObjFW runtime. Patch by Jonathan Schleifer!
llvm-svn: 160102
2012-07-12 02:07:58 +00:00
NAKAMURA Takumi 7073024ffd clang/lib/Basic/CMakeLists.txt: Add missing dependency, ClangDiagnosticComment.
llvm-svn: 160096
2012-07-12 00:27:55 +00:00
Dmitri Gribenko f26054f0fb Enable comment parsing and semantic analysis to emit diagnostics. A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by 
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to 
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).

llvm-svn: 160078
2012-07-11 21:38:39 +00:00
Argyrios Kyrtzidis 6d7833f1b6 Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

llvm-svn: 160074
2012-07-11 20:59:04 +00:00
Jordan Rose 6f524ac9f0 Emit -verify diagnostics even when we have a fatal error.
Previously we'd halt at the fatal error as expected, but not actually emit
any -verify-related diagnostics. This lets us catch cases that emit a
/different/ fatal error from the one we expected.

This is implemented by adding a "force emit" mode to DiagnosticBuilder, which
will cause diagnostics to immediately be emitted regardless of current
suppression. Needless to say this should probably be used /very/ sparingly.

Patch by Andy Gibbs! Tests for all of Andy's -verify patches coming soon.

llvm-svn: 160053
2012-07-11 16:50:36 +00:00
Justin Holewinski 5fafdd9d1d Fix handling of curly braces in NVPTX inline asm
Fixes bug 13322

Patch by Dmitry Mikushin

llvm-svn: 160050
2012-07-11 15:34:55 +00:00
Axel Naumann 23c1676dee LLVM_ON_WIN32 case: use the proper key in the UniqueFiles map.
llvm-svn: 160041
2012-07-11 09:41:34 +00:00
Axel Naumann b307400326 Improve r159256 following Chandler's comments:
Implement UniqueFileContainer::erase(), camelCase, add comment on future optimizations of the cache versus de-optimizations of invalidations.

llvm-svn: 159997
2012-07-10 16:50:27 +00:00
Richard Trieu 50f5f46a93 Properly update the FormattedArgs vector when the template type diffing falls
back to regular type printing.

llvm-svn: 159976
2012-07-10 01:46:04 +00:00
Benjamin Kramer 1e250395fa Wire up -mrdrnd for X86.
For some reason GCC decided to call the feature rdrnd instead of rdrand,
which requires translating it for LLVM.

llvm-svn: 159897
2012-07-07 09:39:18 +00:00
Benjamin Kramer b2c42807a4 Remove unreachable default case to pacify clang's -Wcovered-switch-default.
llvm-svn: 159829
2012-07-06 15:27:25 +00:00
Simon Atanasyan 9780e4a2bb MIPS: Define __mips_dsp_rev / __mips_dspr2 / __mips_dsp macros
if -mdsp or -mdspr2 options are provided.

llvm-svn: 159774
2012-07-05 20:16:22 +00:00
Simon Atanasyan 9c6f1f7f23 MIPS: Add -mdsp/-mno-dsp and -mdspr2/-mno-dspr2 command line options support.
llvm-svn: 159769
2012-07-05 19:23:00 +00:00
Simon Atanasyan 72244b6e4f MIPS: Define __mips16 macro if -mips16 option is provided.
llvm-svn: 159753
2012-07-05 16:06:06 +00:00
Simon Atanasyan 9f444d5a1b MIPS: Replace the pair of boolean flags by enumeration to hold selected float ABI.
llvm-svn: 159752
2012-07-05 15:32:46 +00:00
Simon Atanasyan 6f23fa0f18 MIPS: Add -mips16 / -mno-mips16 command line support.
llvm-svn: 159747
2012-07-05 14:19:39 +00:00
David Chisnall 314896c9fc A few more cleanups for the GNU family of ObjC runtimes.
llvm-svn: 159708
2012-07-04 10:37:03 +00:00
David Chisnall b601c96892 Rename the GCC Objective-C runtime to gcc from gnu-fragile and the GNUstep
runtime to gnustep from gnu.  Fix EH for the GCC runtime.

llvm-svn: 159684
2012-07-03 20:49:52 +00:00
Hal Finkel 6b984f084c Add additional architecture defines for PPC targets.
Patch by Andy Gibbs.

llvm-svn: 159665
2012-07-03 16:51:04 +00:00
Nico Weber 4b18c3ff40 Share ConvertUTF8toWide() between Lex and CodeGen.
llvm-svn: 159634
2012-07-03 02:24:52 +00:00
James Dennett 0bb4164ce8 Documentation cleanup: Delete a duplicated/malformed doc comment.
llvm-svn: 159628
2012-07-02 23:56:17 +00:00
Richard Trieu c605844510 Update the %diff modifer to have an alternate string print when a template tree
is selected.  This will allow more flexibility when converting diagnostics to
use template type diffing.

Also updated the internal manual and test cases for correctly keeping the bold
attribute and for tree printing.

llvm-svn: 159463
2012-06-29 21:12:16 +00:00
Simon Atanasyan 07ce7d8fb5 Support MIPS DSP Rev1 intrinsics.
This patch was reviewed in the llvm-commits list by Jim Grosbach.

llvm-svn: 159366
2012-06-28 18:23:16 +00:00
Axel Naumann b15b37f73a Fix for r159256 on Windows.
llvm-svn: 159262
2012-06-27 11:42:56 +00:00
Axel Naumann 38179d9693 From Vassil Vassilev:
add interface for removing a FileEntry from the cache.
Forces a re-read the contents from disk, e.g. because a tool (like cling) wants to pick up a modified file.

llvm-svn: 159256
2012-06-27 09:17:42 +00:00
Richard Trieu 9184423984 Add template type diffing to Clang. This feature will provide a better
comparison between two templated types when they both appear in a diagnostic.
Type elision will remove indentical template arguments, which can be disabled
with -fno-elide-type.  Cyan highlighting is applied to the differing types.

For more formatting, -fdiagnostic-show-template-tree will output the template
type as an indented text tree, with differences appearing inline. Template
tree works with or without type elision.

llvm-svn: 159216
2012-06-26 18:18:47 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
John McCall 18ac1632f0 Introduce ObjCRuntime::hasWeakClassImport() and use it in the appropriate
places.  I've turned this off for the GNU runtimes --- I don't know if
they support weak class import, but it's easy enough for them to opt in.

Also tweak a comment per review by Jordan.

llvm-svn: 158860
2012-06-20 21:58:02 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Meador Inge cdc0057e3c Revert predefined decl tracking.
r158085 added some logic to track predefined declarations.  The main reason we
had predefined declarations in the input was because the __builtin_va_list
declarations were injected into the preprocessor input.  As of r158592 we 
explicitly build the __builtin_va_list declarations.  Therefore the predefined
decl tracking is no longer needed.

llvm-svn: 158732
2012-06-19 18:17:30 +00:00
Jordan Rose 8d63d5b8e6 Fix the location of the fixit for -Wnewline-eof.
It turns out SourceManager treating the "one-past-the-end" location as invalid,
but then failing to set the invalid flag properly.

llvm-svn: 158699
2012-06-19 03:09:38 +00:00
James Dennett 87a2acf1eb Documentation cleanup: escaped # characters in Doxygen comments.
llvm-svn: 158614
2012-06-17 03:22:59 +00:00
NAKAMURA Takumi 8bd8ee7648 clang/lib/Basic/FileManager.cpp: Detect the root directory with PathV2. It should be better fix for PR10331, or, "clang X:\foo.c" fails.
llvm-svn: 158596
2012-06-16 06:04:10 +00:00
Meador Inge 5d3fb22bac Explicitly build __builtin_va_list.
The target specific __builtin_va_list types are now explicitly built instead
of injecting strings into the preprocessor input.

llvm-svn: 158592
2012-06-16 03:34:49 +00:00
James Dennett 523af827de Documentation cleanup: delete doc comments from source files where they are
broken duplicates of comments that are in the corresponding header files.

llvm-svn: 158550
2012-06-15 21:30:06 +00:00
James Dennett 88b71e4121 Documentation cleanup: escape # in a Doxygen comment.
llvm-svn: 158549
2012-06-15 21:28:23 +00:00
James Dennett 0d8a3f8fb1 Documentation cleanup: escape @ in a Doxygen comment.
llvm-svn: 158548
2012-06-15 21:27:44 +00:00
Hal Finkel 8eb5928514 Add PPC support for translating gcc-style -mcpu options into LLVM -target-cpu options.
This functionality is based on what is done on ARM, and enables selecting PPC CPUs
in a way compatible with gcc's driver. Also, mirroring gcc (and what is done on x86),
-mcpu=native support was added. This uses the host cpu detection from LLVM
(which will also soon be updated by refactoring code currently in backend).

In order for this to work, the target needs a list of valid CPUs -- we now accept all CPUs accepted by LLVM.
A few preprocessor defines for common CPU types have been added.

llvm-svn: 158334
2012-06-11 22:35:19 +00:00
Craig Topper f561a9562d Add XOP feature flag.
llvm-svn: 158284
2012-06-09 22:24:14 +00:00
Douglas Gregor 02c2dbf45e Switch LineTableInfo to use FileID instead of int for file references,
from Tom Honermann!

llvm-svn: 158211
2012-06-08 16:40:28 +00:00
Jordan Rose ccf43ca05c Add pedantic warning -Wempty-translation-unit (C11 6.9p1).
In standard C since C89, a 'translation-unit' is syntactically defined to have
at least one "external-declaration", which is either a decl or a function
definition. In Clang the latter gives us a declaration as well.

The tricky bit about this warning is that our predefines can contain external
declarations (__builtin_va_list and the 128-bit integer types). Therefore our
AST parser now makes sure we have at least one declaration that doesn't come
from the predefines buffer.

Also, remove bogus warning about empty source files. This doesn't catch source
files that only contain comments, and never fired anyway because of our
predefines.

PR12665 and <rdar://problem/9165548>

llvm-svn: 158085
2012-06-06 17:25:21 +00:00
Simon Atanasyan d3d173ddca Mips: Define __mips_hard_float macro additional to __mips_single_float
when single float ABI is selected.

llvm-svn: 157996
2012-06-05 13:06:56 +00:00
Craig Topper 12c9df3a9d Make disabling SSE levels also disable AVX and FMA.
llvm-svn: 157907
2012-06-03 22:23:42 +00:00
Craig Topper 1e9e01fabf Make AES and PCLMUL features imply SSE2 as that's needed to get the right types defined.
llvm-svn: 157906
2012-06-03 21:56:22 +00:00
Craig Topper bba778bfd5 Add fma feature flag for Intel FMA instructions.
llvm-svn: 157904
2012-06-03 21:46:30 +00:00
Craig Topper 3f122a7636 Add builtin for pclmulqdq instruction.
llvm-svn: 157733
2012-05-31 05:18:48 +00:00
Craig Topper 9ee12508ca SSE4A should not imply LZCNT and POPCNT. FMA4 should imply SSE4A. Add missing break at the end of btver1 feature list.
llvm-svn: 157680
2012-05-30 05:54:54 +00:00
Benjamin Kramer 8ac9c22391 Define __SSE4A__ when targeting new AMD CPUs.
This doesn't really fit the existing SSELevel so it gets an extra flag.

llvm-svn: 157630
2012-05-29 17:48:39 +00:00