Commit Graph

775 Commits

Author SHA1 Message Date
Benjamin Kramer f5c4b49278 Wrap bit mangling logic for DiagMappings in its own class so it doesn't leak
into other code. Make it an array instead of a constant-length vector.

llvm-svn: 109384
2010-07-25 21:40:48 +00:00
Nate Begeman 45595cf99f Catch thinko that Daniel Dunbar found.
llvm-svn: 109023
2010-07-21 18:11:42 +00:00
Nate Begeman 6e8865a150 Fix win64 compilation of constants like 0xFFFFFFFFFFFFFFFFULL
intmax_t is __int64 (long long to clang), per VS 2010 stdint.h

llvm-svn: 108980
2010-07-21 02:02:56 +00:00
Douglas Gregor aa21cc401b Introduce a new libclang API, clang_reparseTranslationUnit(), which
reparses an already-parsed translation unit. At the moment it's just a
convenience function, but we hope to use it for performance
optimizations.

llvm-svn: 108756
2010-07-19 21:46:24 +00:00
Chris Lattner ad4f38b1a9 BUILD_ARCHIVE is the default for libraries, no need to set it.
llvm-svn: 108633
2010-07-18 00:14:47 +00:00
Ted Kremenek 5932c35138 Add builtin definition for scanf, including extending the builtin encoding to
represent builtins that have the "scanf" attribution (via the format attribute) just
like we do with printf functions.  Follow-up work is needed to add similar support
for fscanf et al.

This is to support format-string checking for scanf functions.

llvm-svn: 108499
2010-07-16 02:11:15 +00:00
Daniel Dunbar 6f2e839693 CodeGen/ObjC/NeXT: Fix Obj-C message send to match llvm-gcc when choosing
whether to use objc_msgSend_fpret; the choice is target dependent, not Obj-C ABI
dependent.
 - <rdar://problem/8139758> arm objc _objc_msgSend_fpret bug

llvm-svn: 108379
2010-07-14 23:39:36 +00:00
Benjamin Kramer 8d5609b604 Pass StringRefs by value.
llvm-svn: 108375
2010-07-14 23:19:41 +00:00
John Thompson c438947242 Hack for dealing with commas until we support multiple alternative constraints, per pr7338.
llvm-svn: 108028
2010-07-09 22:49:34 +00:00
John Thompson ab71ead011 Revert 107953, remove comma ignoring from PPC constraints.
llvm-svn: 107956
2010-07-09 04:53:08 +00:00
John Thompson 7099f0c0d5 Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.
llvm-svn: 107953
2010-07-09 02:01:40 +00:00
Chris Lattner 3e2ee147d0 add driver support for minix, patch by Kees van Reeuwijk
from PR7583

llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Eric Christopher 17c7b89054 Translate numbers properly.
llvm-svn: 106873
2010-06-25 19:04:52 +00:00
John Thompson ceebdf1fc6 Fixed another double-char in PPC-specific asm constraints.
llvm-svn: 106812
2010-06-25 00:02:05 +00:00
John Thompson 07a61a41c8 Added PPC-specific asm constraints, PS3 configuration changes.
llvm-svn: 106806
2010-06-24 22:44:13 +00:00
Eric Christopher 03256c32ff More clang support for darwin tls. Add a __has_feature macro and
target specific preprocessor define as well.

llvm-svn: 106715
2010-06-24 02:02:00 +00:00
Chris Lattner ed8b6b799d introduce a new CharSourceRange class, and enhance the diagnostics routines
to use them instead of SourceRange.  CharSourceRange is just a SourceRange
plus a bool that indicates whether the range has the end character resolved
or whether the end location is the start of the end token.  While most of
the compiler wants to think of ranges that have ends that are the start of
the end token, the printf diagnostic stuff wants to highlight ranges within
tokens.

This is transparent to the diagnostic stuff.  To start taking advantage of
the new capabilities, you can do something like this:
  Diag(..) << CharSourceRange::getCharRange(Begin,End)

llvm-svn: 106338
2010-06-18 22:45:06 +00:00
Douglas Gregor 0552291859 Update CMake build system for ARM NEON generation.
llvm-svn: 106220
2010-06-17 15:17:41 +00:00
Alexis Hunt c675ec09f0 Update CMake build for new attribute changes.
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Jeffrey Yasskin 2b99c6fc4f Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed.  We default to 'all'.  At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.

llvm-svn: 105815
2010-06-11 05:57:47 +00:00
Charles Davis 95a546ee4d Add an option to specify the target C++ ABI to the frontend. Use it to
select either the default Itanium ABI or the new, experimental Microsoft ABI.

llvm-svn: 105804
2010-06-11 01:06:47 +00:00
Rafael Espindola ad8fed53ff Create a LinuxTargetInfo on ARM. This make clang correctly expand
__USER_LABEL_PREFIX__.

llvm-svn: 105771
2010-06-10 00:46:51 +00:00
Anders Carlsson 851318a93a On Darwin, initialization and destruction functions should go into the __StaticInit section.
llvm-svn: 105650
2010-06-08 22:47:50 +00:00
Daniel Dunbar ee6b692551 Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar e6c1daa8fd Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
- This eliminates most dependencies on how Clang is installed relative to LLVM.

llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Rafael Espindola e971b9a260 Correctly align large arrays in x86-64. This fixes PR5599.
llvm-svn: 105500
2010-06-04 23:15:27 +00:00
Daniel Dunbar 0e15c9aef6 Accept '#pragma options align=mac68k' on Darwin/PPC and Darwin/PPC64.
llvm-svn: 105116
2010-05-30 00:07:30 +00:00
John McCall 61d8258fa3 Roll back r104941.
llvm-svn: 104990
2010-05-28 18:25:28 +00:00
John McCall 2177a9b65a Add a new attribute on records, __attribute__((adl_invisible)), and define
the x86-64 __va_list_tag with this attribute.  The attribute causes the
affected type to behave like a fundamental type when considered by ADL.

(x86-64 is the only target we currently provide with a struct-based
__builtin_va_list)

Fixes PR6762.

llvm-svn: 104941
2010-05-28 08:20:36 +00:00
Daniel Dunbar 3eeeccd6e2 Darwin/ARM seems to support mac68k align as well.
llvm-svn: 104828
2010-05-27 07:00:26 +00:00
Daniel Dunbar bd60652ace Sema: Reject '#pragma options align=mac68k' everywhere except i386-apple-darwin.
llvm-svn: 104789
2010-05-27 00:35:16 +00:00
Chris Lattner c425fe4c80 don't make _Bool be a keyword in -fms-extensions mode, patch by
Steven Watanabe!

llvm-svn: 104373
2010-05-21 20:22:37 +00:00
Chandler Carruth dd8f20dfb6 Update the types for warning option subgroup arrays to 'short', we have more
than 127 groups so this was already failing given -fsigned-char. A subsequent
to commit to TableGen will generate shorts for the arrays themselves.

llvm-svn: 103703
2010-05-13 07:43:05 +00:00
Chris Lattner a99fa1aee1 clean up isBeforeInTranslationUnit by factoring out some common
code into a MoveUpIncludeHierarchy helper, and use the helper to
fix a case involving macros which regressed from my recent patch.

llvm-svn: 103288
2010-05-07 20:35:24 +00:00
Chris Lattner 06821c9e90 reimplement the guts of SourceManager::isBeforeInTranslationUnit
to be algorithmically faster and avoid an std::map.  This routine
basically boils down to finding the nearest common ancestor in a
tree, and we (implicitly) have information about nesting depth,
use it!

This wraps up rdar://7948633 - SourceManager::isBeforeInTranslationUnit has poor performance

llvm-svn: 103239
2010-05-07 05:51:13 +00:00
Chris Lattner 46e3b4808f start using the caching now that it appears to work!
llvm-svn: 103236
2010-05-07 05:10:46 +00:00
Chris Lattner 66d2f924b4 reimplement the caching in the SourceManager::isBeforeInTranslationUnit()
method to be correct.  Right now it correctly computes the cache, then
goes ahead and computes the result the hard way, then asserts that they 
match.  Next I'll actually turn it on.

llvm-svn: 103231
2010-05-07 01:17:07 +00:00
Daniel Dunbar 0b9729887c Basic: Update getClangRepositoryPath for my change to integration branch layout.
llvm-svn: 103192
2010-05-06 18:39:38 +00:00
Ted Kremenek 5b0773e201 Workaround a really serious caching bug in SourceManager::isBeforeInTranslationUnit() where the
method will sometimes return different results for the same input SourceLocations.  I haven't
unraveled this method completely yet, so this truly is a workaround until a better fix comes
along.

llvm-svn: 103143
2010-05-06 00:22:25 +00:00
Chris Lattner 4531cc5529 When -fdiagnostics-print-source-range-info is specified,
print the diagnostic category number in the [] at the end
of the line.  For example:

$ cat t.c 
#include <stdio.h>
void foo() {
 printf("%s", 4);
}
$  clang t.c -fsyntax-only -fdiagnostics-print-source-range-info
t.c:3:11:{3:10-3:12}{3:15-3:16}: warning: conversion specifies type 'char *' but the argument has type 'int' [-Wformat,1]
  printf("%s", 4);
          ~^   ~
1 warning generated.

Clients that want category information can now pick the number 
out of the output, rdar://7928231.

More coming.

llvm-svn: 103053
2010-05-04 21:13:21 +00:00
Chris Lattner 216c33beba add the ability to associate 'category' names with diagnostics
and diagnostic groups.  This allows the compiler to group 
diagnostics together (e.g. "Logic Warning", 
"Format String Warning", etc) like the static analyzer does.
This is not exposed through anything in the compiler yet.

llvm-svn: 103051
2010-05-04 20:44:26 +00:00
Chris Lattner 1a8f394a1f david conrad points out that {|} in inline assembly on arm are not asm
variants.  This fixes neon inline asm which my patch for PR6780 broke.

llvm-svn: 102181
2010-04-23 16:29:58 +00:00
Chris Lattner 8b29021712 another tweak for haiku support, patch by Paul Davey!
llvm-svn: 102098
2010-04-22 17:48:00 +00:00
Daniel Dunbar f812506912 ARM/APCS: Don't respect bit-field types when laying out structures.
- This fixes the last known ABI issues with ARM/APCS.

 - I've run the first 1k ABITests with '--no-unsigned --no-vector --no-complex'
   on {armv6, armv7} x {-mno-thumb, -mthumb}, and the first 10k tests for armv7
   -mthumb, for both function return types and single argument calls. These all
   pass now (they failed horribly before without --no-bitfield).

llvm-svn: 102070
2010-04-22 16:14:54 +00:00
Douglas Gregor 3ecc665505 Sink the _GNU_SOURCE definition down into the target configuration,
and only define it where we know we need it---Linux and Cygwin. Thanks
to Chris for the prodding.

llvm-svn: 101989
2010-04-21 05:52:38 +00:00
Chris Lattner 8f5bc9f0e1 change FullSourceLoc to have a *const* SourceManager&, eliminating
a const_cast.

llvm-svn: 101940
2010-04-20 20:49:23 +00:00
Chris Lattner fb24a3a4ec push some source location information down through the compiler,
into ContentCache::getBuffer.  This allows it to produce 
diagnostics on the broken #include line instead of without a 
location.

llvm-svn: 101939
2010-04-20 20:35:58 +00:00
Chris Lattner 8fbe98b3b6 enhance sourcemgr to detect various UTF BOM's and emit a fatal error
about it instead of producing tons of garbage from the lexer.

It would be even better for sourcemgr to dynamically transcode (e.g.
from UTF16 -> UTF8).

llvm-svn: 101924
2010-04-20 18:14:03 +00:00
Douglas Gregor ffed1cb339 Introduce a limit on the depth of the template instantiation backtrace
we will print with each error that occurs during template
instantiation. When the backtrace is longer than that, we will print
N/2 of the innermost backtrace entries and N/2 of the outermost
backtrace entries, then skip the middle entries with a note such as:

  note: suppressed 2 template instantiation contexts; use
  -ftemplate-backtrace-limit=N to change the number of template
  instantiation entries shown

This should eliminate some excessively long backtraces that aren't
providing any value.

llvm-svn: 101882
2010-04-20 07:18:24 +00:00
Chandler Carruth e03aa55bfd Add support for '-fgnu-keywords' and '-fasm' to Clang's driver. They are not
implemented precisely the same as GCC, but the distinction GCC makes isn't
useful to represent. This allows parsing code which uses GCC-specific keywords
('asm', etc.) without parsing in a fully GNU mode.

llvm-svn: 101667
2010-04-17 20:17:31 +00:00
Daniel Dunbar 9302f60606 clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.
llvm-svn: 101370
2010-04-15 15:06:22 +00:00
Daniel Dunbar 1da6511b99 Tweak spelling (Bitfield -> BitField)
llvm-svn: 101369
2010-04-15 15:06:18 +00:00
Daniel Dunbar 3d9289c736 Add TargetInfo::useBitfieldTypeAlignment().
- Used to determine whether the alignment of the type in a bit-field is
   respected when laying out structures. The default is true, targets can
   override this as needed.

 - This is designed to correspond to the PCC_BITFIELD_TYPE_MATTERS macro in
   gcc. The AST/Sema implementation only affects one line, unless I have
   forgotten something. I'd appreciate further review.

 - IRgen still needs to be updated to fully support this (which is effectively
   PR5591).

llvm-svn: 101356
2010-04-15 06:18:39 +00:00
Douglas Gregor 2d2d90750c Once we've emitted a fatal diagnostic, keep counting errors but with a
separate count of "suppressed" errors. This way, semantic analysis
bits that depend on the error count to determine whether problems
occured (e.g., some template argument deduction failures, jump-scope
checking) will not get confused.

The actual problem here is that a missing #include (which is a fatal
error) could cause the jump-scope checker to run on invalid code,
which it is not prepared to do. Trivial fix for both
<rdar://problem/7775941> and <rdar://problem/7775709>.

llvm-svn: 101297
2010-04-14 22:19:45 +00:00
Chris Lattner 97a8e43a02 fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic
actually turned it on.  If a diag is produced by a warning which
is an extension but defaults to on, and has no warning group, don't
print any option info.

llvm-svn: 101071
2010-04-12 21:53:11 +00:00
Ted Kremenek 39a7665832 Fix null dereference in 'WriteSourceLocation' when the FileEntry is null.
llvm-svn: 101060
2010-04-12 19:54:17 +00:00
Chris Lattner b986aba6db add haiku support, patch by Paul Davey!
llvm-svn: 100982
2010-04-11 19:29:39 +00:00
Daniel Dunbar 584344f2ec Disable diag::err_file_modified on Win32 completely, until someone cares to fix
it. PR6812.
 - This is another attempt at silencing annoying buildbot failures.

llvm-svn: 100914
2010-04-10 01:17:16 +00:00
Douglas Gregor 08288f2846 On Windows, disable the modification-time check for files used in
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.

llvm-svn: 100866
2010-04-09 15:54:22 +00:00
Chris Lattner dec49e77e5 add clang -cc1 level support for "-ferror-limit 42"
llvm-svn: 100687
2010-04-07 20:37:06 +00:00
Chris Lattner 75a0393eb5 add capabilities to stop emitting errors after some limit.
Right now the limit is 0 (aka disabled)

llvm-svn: 100684
2010-04-07 20:21:58 +00:00
Chris Lattner 198cb4df6e Instead of counting totally diagnostics, split the count into a count
of errors and warnings.  This allows us to emit something like this:

2 warnings and 1 error generated.

instead of:

3 diagnostics generated.

This also stops counting 'notes' because they are just follow-on information
about the previous diag, not a diagnostic in themselves.

llvm-svn: 100675
2010-04-07 18:47:42 +00:00
Eric Christopher e1ddaf911b Add option and macro definition for AES instructions. Now produces real
assembly for testcases.

llvm-svn: 100253
2010-04-02 23:50:19 +00:00
Douglas Gregor a771f46c82 Reinstate my CodeModificationHint -> FixItHint renaming patch, without
the C-only "optimization".

llvm-svn: 100022
2010-03-31 17:46:05 +00:00
Douglas Gregor 30e631862f Revert r100008, which inexplicably breaks the clang-i686-darwin10 builder
llvm-svn: 100018
2010-03-31 17:25:35 +00:00
Douglas Gregor 3baad0d4f7 Rename CodeModificationHint to FixItHint, since we've been using the
term "fix-it" everywhere and even *I* get tired of long names
sometimes. No functionality change.

llvm-svn: 100008
2010-03-31 15:31:50 +00:00
Douglas Gregor 8933623b91 Optimize PartialDiagnostic's memory-allocation behavior by placing a
cache of PartialDiagnostic::Storage objects into an allocator within
the ASTContext. This eliminates a significant amount of malloc
traffic, for a 10% performance improvement in -fsyntax-only wall-clock
time with 403.gcc's combine.c.

Also, eliminate the RequireNonAbstractType hack I put in earlier,
which was but a symptom of this larger problem.

Fixes <rdar://problem/7806091>.

llvm-svn: 99849
2010-03-29 23:34:08 +00:00
Douglas Gregor 210b590562 Teach the diagnostic engine to provide more detailed information about
how to handle a diagnostic during template argument deduction, which
may be "substitution failure", "suppress", or "report". This keeps us
from, e.g., emitting warnings while performing template argument
deduction.

llvm-svn: 99560
2010-03-25 22:17:48 +00:00
John Thompson 957816fbf3 PS3 needs __PPC__. Should this be in the PPC target?
llvm-svn: 99513
2010-03-25 16:18:32 +00:00
Douglas Gregor 963809884f Fix a thinko and a typo in the delayed-diagnostic code.
llvm-svn: 99178
2010-03-22 15:47:45 +00:00
Douglas Gregor 8579531684 Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.

llvm-svn: 99175
2010-03-22 15:10:57 +00:00
Douglas Gregor b41ca8f2ae Keep track of the size/modification time of each file source-location
entry in a precompiled header, so that we can detect modified files
even when we miss in the stat cache.

llvm-svn: 99149
2010-03-21 22:49:54 +00:00
Douglas Gregor 51c2351d30 Fix a longstanding (but previously unknown) bug in the lazy
deserialization of precompiled headers, where the deserialization of
the source location entry for a buffer (e.g., macro instantiation
scratch space) would overwrite a one-element FileID cache in the
source manager. When tickled at the wrong time, we would return the
wrong decomposed source location and eventually cause c-index-test to
crash.

Found by dumb luck. It's amazing this hasn't shown up before.

llvm-svn: 98940
2010-03-19 06:12:06 +00:00
Douglas Gregor 22fde23b6e Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.

llvm-svn: 98726
2010-03-17 15:33:06 +00:00
Douglas Gregor 6597f59506 Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.

llvm-svn: 98725
2010-03-17 15:30:15 +00:00
Douglas Gregor 82752ec843 Teach SourceManager's content cache to keep track of whether its
buffer was invalid when it was created, and use that bit to always set
the "Invalid" flag according to whether the buffer is invalid. This
ensures that all accesses to an invalid buffer are marked invalid,
improving recovery.

llvm-svn: 98690
2010-03-16 22:53:51 +00:00
Douglas Gregor a71b9d0678 Update get*LineNumber() and get*ColumnNumber() functions to pass the
Invalid bit through; there are no safety-critical callers of these
functions.

llvm-svn: 98674
2010-03-16 20:53:17 +00:00
Douglas Gregor 42fe858cd6 Audit all callers of SourceManager::getCharacterData(); update some of
them to recover more gracefully on failure.

llvm-svn: 98672
2010-03-16 20:46:42 +00:00
Douglas Gregor 4fb7fbef3b Audit all getBuffer() callers (for both the FullSourceLoc and
SourceManager versions), updating those callers that need to recover
gracefully from failure.

llvm-svn: 98665
2010-03-16 20:01:30 +00:00
Benjamin Kramer 0ca3c62078 Switch another function to StringRef instead of char pointer pairs.
llvm-svn: 98631
2010-03-16 14:48:07 +00:00
Benjamin Kramer eb92dc0b09 Let SourceManager::getBufferData return StringRef instead of a pair of two const char*.
llvm-svn: 98630
2010-03-16 14:14:31 +00:00
Douglas Gregor 7bda4b8310 Introduce optional "Invalid" parameters to routines that invoke the
SourceManager's getBuffer() and, therefore, could fail, along with
Preprocessor::getSpelling(). Use the Invalid parameters in the literal
parsers (string, floating point, integral, character) to make them
robust against errors that stem from, e.g., PCH files that are not
consistent with the underlying file system.

I still need to audit every use caller to all of these routines, to
determine which ones need specific handling of error conditions.

llvm-svn: 98608
2010-03-16 05:20:39 +00:00
Douglas Gregor 874cc62876 Use SourceManager's Diagnostic object for all file-reading errors,
simplifying the SourceManager interfaces somewhat.

llvm-svn: 98598
2010-03-16 00:35:39 +00:00
Douglas Gregor e0fbb83b8b Give SourceManager a Diagnostic object with which to report errors,
and start simplifying the interfaces in SourceManager that can fail.

llvm-svn: 98594
2010-03-16 00:06:06 +00:00
Douglas Gregor 0adf3182b0 Add some <cstdio> includes to unbreak the buildbots
llvm-svn: 98591
2010-03-15 23:33:37 +00:00
Douglas Gregor 802b77601e Introduce a new BufferResult class to act as the return type of
SourceManager's getBuffer() (and similar) operations. This abstract
can be used to force callers to cope with errors in getBuffer(), such
as missing files and changed files. Fix a bunch of callers to use the
new interface.

Add some very basic checks for file consistency (file size,
modification time) into ContentCache::getBuffer(), although these
checks don't help much until we've updated the main callers (e.g.,
SourceManager::getSpelling()).

llvm-svn: 98585
2010-03-15 22:54:52 +00:00
Kovarththanan Rajaratnam 00682a48f4 Reintroduce r98340 and r98341 now without copy/paste errors.
Thanks to Ben for pointing this out.

llvm-svn: 98345
2010-03-12 11:27:37 +00:00
Kovarththanan Rajaratnam e604f14c96 Back out r98340 abd r98341
llvm-svn: 98344
2010-03-12 11:00:51 +00:00
Nuno Lopes 4cbc8bd1bc fix PR6584: __SSE3__ not defined with -mss3
llvm-svn: 98342
2010-03-12 10:20:09 +00:00
Kovarththanan Rajaratnam f1aa69d103 Switch parameter order for consistency (no functionality change)
llvm-svn: 98341
2010-03-12 10:17:07 +00:00
Kovarththanan Rajaratnam e2acea7c53 Add keywords using StringRef
llvm-svn: 98340
2010-03-12 10:14:26 +00:00
Ted Kremenek 4a26524050 Fix -Wsign-compare warning reported by clang++.
llvm-svn: 98170
2010-03-10 18:22:38 +00:00
Chris Lattner 5178f56255 add mblaze target support, patch by Wesley Peck!
llvm-svn: 97890
2010-03-06 21:21:27 +00:00
Benjamin Kramer d4870700ad Make sure the raw_string_ostream gets flushed so we don't accidentally return an empty string.
llvm-svn: 97809
2010-03-05 15:39:20 +00:00
Chris Lattner 09797543bd add TCE target support, patch by Pekka J!
llvm-svn: 97746
2010-03-04 21:07:38 +00:00
Eric Christopher cfeceffa27 Add in disabled case as well.
llvm-svn: 97716
2010-03-04 02:31:44 +00:00
Eric Christopher 399ffa55d2 Add in -msse4.1 and -msse4.2 options and continuing a rather
hacky solution for translating.  Expanded on comment explaining
the hack a bit.

llvm-svn: 97714
2010-03-04 02:26:37 +00:00
Chris Lattner 5cc15e058b add framework for ARM builtins, Patch by Edmund Grimley Evans!
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
Ted Kremenek c9ef64ff67 Use SVN_REVISION, not SVN_VERSION.
llvm-svn: 97625
2010-03-03 01:30:39 +00:00
Ted Kremenek 47307292f1 Make getClangRevision() check that SVN_VERSION is an empty string
(even if it is defined).  This fixes the issue of this function
returning '0' when SVN_VERSION is defined to be "".

Fixes: <rdar://problem/7663667>
llvm-svn: 97620
2010-03-03 01:02:48 +00:00
Eric Christopher 0b26a616eb Add in some more MIPS command line options.
Patch by Oleksandr Tymoshenko!

llvm-svn: 97544
2010-03-02 02:41:08 +00:00
Douglas Gregor b8b9f28e24 Robustify SourceManager::getLocation(), so that it returns an
end-of-line source location when given a column number beyond the
length of the line, or an end-of-file source location when given a
line number beyond the length of the file. Previously, we would return
an invalid location.

llvm-svn: 97299
2010-02-27 02:42:25 +00:00
Douglas Gregor 70127c1dcf Use a little binary header in serialized diagnostics to help the deserializer skip over noise in the stream
llvm-svn: 96641
2010-02-19 00:40:40 +00:00
Douglas Gregor 1e21cc7d19 Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
try to address the msvc failures.

llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Douglas Gregor 33cdd81064 Rework how CIndex handles diagnostics. Rather than using a callback,
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.

To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.

I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.

llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Chris Lattner db5c16bc9c add freebsd/ppc[64] support, patch by Nathan Whitehorn, PR6318
llvm-svn: 96362
2010-02-16 18:14:57 +00:00
Sanjiv Gupta ecd2600c52 Re-applying 96173. Looks like finally I got the test case right.
llvm-svn: 96321
2010-02-16 03:37:11 +00:00
Sanjiv Gupta 9d23f93d52 reverting back 96242 as it still causes a test failure.
llvm-svn: 96244
2010-02-15 18:02:12 +00:00
Sanjiv Gupta af56d377f1 Re-applying 96173 with corresponding changes in test.
llvm-svn: 96242
2010-02-15 17:19:13 +00:00
Chris Lattner d0413848cc temporarily revert 96173, it is causing test failures.
llvm-svn: 96176
2010-02-14 18:38:38 +00:00
Sanjiv Gupta 1ef8cdd29b renamed pic16 specifiic macros.
llvm-svn: 96173
2010-02-14 18:20:18 +00:00
Ted Kremenek 8bd0929d41 Fix bug I introduced with assinging a temporary to a StringRef.
llvm-svn: 96041
2010-02-12 23:31:14 +00:00
Ted Kremenek a3e657064b Make the following functions thread-safe but having them return an std::string that is reconstructed
every time they are called:

getClangRevision()
getClangFullRepositoryVersion()
getClangFullVersion()

llvm-svn: 96033
2010-02-12 22:54:40 +00:00
Chris Lattner 5647d3192c fix a bug in SourceManager::getInstantiationLocSlowCase, where
we'd add an offset from the spelling location space to the 
instantiation location, which doesn't make sense and would
lead up to the text diagnostics crashing when presented with
non-sensical locations.

This fixes rdar://7597492, a crash on 255.vortex.

llvm-svn: 96004
2010-02-12 19:31:35 +00:00
John McCall be089fa86b Suppress warnings if their instantiation location is in a system header, not
their spelling location.  This prevents warnings from being swallowed just
because the caret is on the first parenthesis in, say, NULL.

This is an experiment;  the risk is that there might be a substantial number
of system headers which #define symbols to expressions which inherently cause
warnings.  My theory is that that's rare enough that it can be worked
around case-by-case, and that producing useful warnings around NULL is worth 
it.  But I'm willing to accept that I might be empirically wrong.

llvm-svn: 95870
2010-02-11 10:04:29 +00:00
Daniel Dunbar 3241d400c8 Switch to using -fsjlj-exceptions instead of hard-coding it. Notably, this fixes
calls to the UnwindResumeOrRethrow function for C++/Obj-C exception handling,
for Darwin ARM.

llvm-svn: 95787
2010-02-10 18:49:11 +00:00
John Thompson 2233460de6 First stage of adding AltiVec support
llvm-svn: 95335
2010-02-05 00:12:22 +00:00
Chris Lattner 5b5d2db3f6 Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850

llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Benjamin Kramer 31a68e70a5 Simplify FreeBSD version parsing.
llvm-svn: 94919
2010-01-30 19:55:01 +00:00
Anders Carlsson c7c5baa482 Yay for more StringRefs.
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Anders Carlsson 0b0a122fde StringRef-ize the TargetInfo::ConstraintInfo constructor.
llvm-svn: 94916
2010-01-30 18:33:31 +00:00
Benjamin Kramer a87bdb793e We don't need to place 0 in the URL string now that we return a StringRef.
- URL can go into read only memory now.
- Compilers will fold away all the strstr calls.

llvm-svn: 94887
2010-01-30 14:01:39 +00:00
Anton Korobeynikov cbc4e98381 Fix alignment for msp430 integer types.
llvm-svn: 94879
2010-01-30 12:55:11 +00:00
Douglas Gregor ac0605e927 Introduce serialization and deserialization of diagnostic information
so that CIndex can report diagnostics through the normal mechanisms
even when executing Clang in a separate process. This applies both
when performing code completion and when using ASTs as an intermediary
for clang_createTranslationUnitFromSourceFile().

The serialized format is not perfect at the moment, because it does
not encapsulate macro-instantiation information. Instead, it maps all
source locations back to the instantiation location. However, it does
maintain source-range and fix-it information. To get perfect fidelity
from the serialized format would require serializing a large chunk of
the source manager; at present, it isn't clear if this code will live
long enough for that to matter.

llvm-svn: 94740
2010-01-28 06:00:51 +00:00
Daniel Dunbar 377dc2f91f ARM/APCS: Fix alignment of long double.
llvm-svn: 94685
2010-01-27 20:23:08 +00:00
Anders Carlsson e437c6870a Add support for 3dnow and 3dnowa, and define the target macros accordingly. (This is needed in order to build Qt).
llvm-svn: 94658
2010-01-27 03:47:49 +00:00
Daniel Dunbar d86666ffd7 Driver/Darwin: Stuff iPhoneOS into environment portion of the (llvm/clang) triple instead of keying off architecture. Also, fix version define to properly include the revision/micro component of the version number.
llvm-svn: 94487
2010-01-26 01:44:04 +00:00
Chris Lattner 0bcc858a2b -fno-rtti is now the default.
llvm-svn: 94379
2010-01-24 20:43:31 +00:00
Ted Kremenek 4c0df3dc1d Rename getClangFullVendorVersion() to getClangFullVersion().
llvm-svn: 94273
2010-01-23 02:11:34 +00:00
Ted Kremenek c0f3f72fa4 Add 'clang_getClangVersion()' function to CIndex. This exposes the full Clang version string through the CIndex API.
llvm-svn: 94242
2010-01-22 22:44:15 +00:00
Ted Kremenek 51b8bc93f8 Move version string generation (e.g., "clang 1.1 ...") to libBasic/Version.cpp, getClangFullVendorVersion().
llvm-svn: 94235
2010-01-22 22:29:50 +00:00
Ted Kremenek 18e066f6a9 (1) Rename getClangSubversionRevision() to getClangRevision(), and
have it return a StringRef instead of an integer (to be more VCS
    agnostic).

(2) Add getClangFullRepositoryVersion(), which contains an
    amalgamation of the repository name and the revision.

(3) Change PCH to only emit the string returned by
    getClangFullRepositoryVersion() instead of also emitting the value
    of getClangSubversionRevision() (which has been removed).  This is
    functionally equivalent.

More cleanup to version string generation pending...

llvm-svn: 94231
2010-01-22 22:12:47 +00:00
Ted Kremenek 2377a0e0ea Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
llvm-svn: 94213
2010-01-22 20:55:35 +00:00
Daniel Dunbar ae928714df Update to use llvm/utils/GetSourceVersion to detect version number, instead of
assuming SVN. This should be fixed to not necessarily be an integer.

llvm-svn: 94081
2010-01-21 16:56:47 +00:00
Chandler Carruth 26b29a0892 Move the MacroBuilder utilitiy to its own header. Update references.
Comments and/or improvements to the documentation are welcome.

llvm-svn: 93982
2010-01-20 06:13:02 +00:00
Chandler Carruth 5b6d9265ba Actually remove the include that r93974 made unnecessary.
llvm-svn: 93975
2010-01-20 04:09:11 +00:00
Anton Korobeynikov 6bedbf1039 long long is 64 bits on msp430
llvm-svn: 93451
2010-01-14 20:22:45 +00:00
John McCall 8cb7a8a39c Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuation
characters to be escaped and implement a scan-forward function which
properly respects brace nesting.

llvm-svn: 93447
2010-01-14 20:11:39 +00:00
John McCall 9015cde4dc Add the %ordinal format modifier for turning '1' into '1st'. Hard-coded for
English right now;  would not be impossible to grab a special format string
from the diagnostic pool and localize that way.

llvm-svn: 93390
2010-01-14 00:50:32 +00:00
John McCall e4d5432136 Perform format-expansion on %select results.
llvm-svn: 93377
2010-01-13 23:58:20 +00:00
Fariborz Jahanian 3f7b8b274d Predefine __weak attribute when doing objective-c
rewriting for any target. (refixes radar 7530235).

llvm-svn: 93331
2010-01-13 18:51:17 +00:00
Fariborz Jahanian 42c06998ea Define __weak attribute for objective-c pointers in
win32 targets. Fixes radar 7530235. Daniel please review.

llvm-svn: 93246
2010-01-12 18:33:57 +00:00
Benjamin Kramer dc2f006f4e Hopefully unbreak build with g++ >= 4.3.
llvm-svn: 93060
2010-01-09 18:20:57 +00:00
Benjamin Kramer 2d6fda3205 Use MacroBuilder for TargetDefines instead of std::vector.
llvm-svn: 93058
2010-01-09 17:55:51 +00:00
Chris Lattner 002ba6b4d0 improve support for dragonfly, patch by Sascha Wildner!
llvm-svn: 93044
2010-01-09 05:41:14 +00:00
Nuno Lopes cfca1f0dc1 move a few more symbols to .rodata/.data.rel.ro
llvm-svn: 92012
2009-12-23 17:49:57 +00:00
Chris Lattner 801fda871b implement -W[no-]fatal-errors, patch by Christian Adåker!
llvm-svn: 91938
2009-12-22 23:12:53 +00:00
Daniel Dunbar 42fe663e3b ARM: Remove a FIXME, it's not actually more complicated than that.
llvm-svn: 91924
2009-12-22 21:59:17 +00:00
Daniel Dunbar 0def3d17cb ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly".
- Correctly is in quotes, because we are following what I interpreted as GCC's
   intent (which diverges from practice, naturally).
 - Also, fix the arch define for arm1136jf-s.

llvm-svn: 91855
2009-12-21 23:28:17 +00:00
Daniel Dunbar 893d475ba8 ARM: Use front-end specific target features "soft-float" and "soft-float-abi" to communicate FP mode to target; __SOFTFP__ is set correctly now.
llvm-svn: 91755
2009-12-19 04:15:38 +00:00
Daniel Dunbar 7b245eda5e Targets: Allow CreateTargetInfo to mutate the target features.
- In particular, it can claim features for itself instead of always passing them on to LLVM.
 - This allows using the target features as a generic mechanism for passing target specific options to the TargetInfo instance, which may need them for initializing preprocessor defines, etc.

llvm-svn: 91753
2009-12-19 03:30:57 +00:00
Anton Korobeynikov d7e4a095c9 Add f80 entry for windows targets
llvm-svn: 91746
2009-12-19 02:05:07 +00:00
Anton Korobeynikov d94329a545 Use proper alignment for i16/i32 on msp430. This fixes PR5815.
llvm-svn: 91739
2009-12-19 01:32:37 +00:00
Daniel Dunbar c454ecf9d0 ARM: Define __thumb2__ for V6T2 targets and only define
__USING_SJLJ_EXCEPTIONS__ on Darwin.

llvm-svn: 91705
2009-12-18 19:57:13 +00:00
Daniel Dunbar acde99ea52 ARM: Fix predefines (__ARM_ARCH_..., __REGISTER_PREFIX).
- This should be done leveraging the backend, but I'm a little refactored
   out. I'll fix it one day, I promise.

llvm-svn: 91700
2009-12-18 18:42:37 +00:00
John Thompson 6f8dba7f9e Tweaks for PS3 target.
llvm-svn: 91685
2009-12-18 14:21:08 +00:00
John Thompson 551446b31b Removing trailing directory separator, to make stat work
llvm-svn: 91684
2009-12-18 14:18:21 +00:00
Nuno Lopes 2af2af219f fix PR5689: add support for 'o' and 'V' asm input operands
llvm-svn: 91540
2009-12-16 14:28:21 +00:00
Daniel Dunbar 2f1a6c1104 FileManager: Do not cache failed stats, it is easy to construct common
inconsistent situations if we do, and they are not important for PCH performance
(which currently only needs the stats to construct the initial FileManager
entries).
 - No test case, sorry, the machinations are too involved.

This occurs when, for example, the build makes a PCH file and has a header map
or a -I for a directory that does not yet exist. It is possible we will cache
the negative stat on that directory, and then in the build we will never find
header files inside that dir.

For PCH we don't need these stats anyway for performance, so this also makes PCH
files smaller w/ no loss. I hope to eventually eliminate the stat cache
entirely.

llvm-svn: 91082
2009-12-11 00:27:20 +00:00
Daniel Dunbar 7cea5f1747 Add a pretty horrible hack to prevent clang from crashing with inconsistent PCH
files.
 - The issue is that PCH uses a stat cache, which may reference files which have
   been deleted or moved. In such cases ContentCache::getBuffer was returning 0
   but most clients are incapable of dealing with this (i.e., they don't).

   For the time being, resolve this issue by just making up some invalid file
   contents and. Eventually we should detect that we are in an inconsistent
   situation and error out with a nice message that the PCH is out of date.

llvm-svn: 90699
2009-12-06 05:43:36 +00:00
Steve Naroff c275f70bf9 Remove 'LangOpts' from Diagnostic (added in http://llvm.org/viewvc/llvm-project?view=rev&revision=90642).
Simply use the 'LangOpts' member already present in TextDiagnosticPrinter.

Sorry for the confusion!

llvm-svn: 90664
2009-12-05 12:23:07 +00:00
Steve Naroff 4fb3d9fcd7 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71086

Note - This commit only includes the fix for:

<rdar://problem/6309338> slightly different error message format for Visual Studio.

The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.

llvm-svn: 90642
2009-12-05 02:14:08 +00:00
Douglas Gregor 5f49883488 Minor cleanup to the code-completion-point logic suggested by Chris.
llvm-svn: 90459
2009-12-03 17:05:59 +00:00
Douglas Gregor 407e2124bf Extend -remap-file=from;to to permit mapping from a non-existent
file. This is accomplished by introducing the notion of a "virtual"
file into the file manager, which provides a FileEntry* for a named
file whose size and modification time are known but which may not
exist on disk.

Added a cute little test that remaps both a .c file and a .h file it
includes to alternative files.

llvm-svn: 90329
2009-12-02 18:12:28 +00:00
Douglas Gregor 53ad6b94b0 Extend the source manager with the ability to override the contents of
files with the contents of an arbitrary memory buffer. Use this new
functionality to drastically clean up the way in which we handle file
truncation for code-completion: all of the truncation/completion logic
is now encapsulated in the preprocessor where it belongs
(<rdar://problem/7434737>).

llvm-svn: 90300
2009-12-02 06:49:09 +00:00
Douglas Gregor 2a1b691622 Eliminate the unnecessary FirstFID cache variable from the source manager's ContentCache
llvm-svn: 90294
2009-12-02 05:34:39 +00:00
Daniel Dunbar 465f4c4867 In SourceManager::isBeforeInTranslationUnit, if we are trying to compare two source locations with no common ancestor in the include stack, determine order by assuming memory buffers preceed files, and then that FileIDs are created in order.
The later assumption is patently false, but this was already broken -- this situation is conceptually impossible, my feeling is we should fix SourceManager and friends to make it impossible in practice as well. However, we need to fix PR5662 and perhaps some other things involving memory buffers first. In the short term I'm pretty sure this is reliable.

Chris, Argiris, is this going to break anything that wasn't already broken?

llvm-svn: 90280
2009-12-01 23:07:57 +00:00
Chris Lattner ed3b360290 pass the reason for failure up from MemoryBuffer and report it
in diagnostics when we fail to open a file.  This allows us to
report things like:

$ clang test.c -I.
test.c:2:10: fatal error: error opening file './foo.h': Permission denied
#include "foo.h"
         ^

llvm-svn: 90276
2009-12-01 22:52:33 +00:00
Daniel Dunbar 4886c8154d Convert Diagnostic::getCustomDiagID to take a StringRef.
llvm-svn: 90244
2009-12-01 17:42:06 +00:00
Kovarththanan Rajaratnam 7632da4b8a This patch adds a PUNCTUATOR macro (specialization of TOK) in TokenKinds.def and makes use of it in tok::getTokenSimpleSpelling.
llvm-svn: 90042
2009-11-28 16:09:28 +00:00
Edward O'Callaghan 847f2a10ee Add SigAtomicType to TargetInfo, Needed for MSP and PIC Targets, Credit to Ken Dyck.
llvm-svn: 89520
2009-11-21 00:49:54 +00:00
John Thompson e467e19766 Added preliminary support step for PS3
llvm-svn: 89362
2009-11-19 17:18:50 +00:00
Daniel Dunbar 2208c57116 Eliminate TargetInfo::getDefaultLangOptions, this kind of logic is better done
in the driver.

llvm-svn: 89073
2009-11-17 09:15:44 +00:00
Daniel Dunbar 4656c53e12 Move -fnext-runtime defaulting to driver (and change clang-cc default to
-fnext-runtime), instead of using getDefaultLangOptions.

llvm-svn: 89058
2009-11-17 07:07:28 +00:00
Daniel Dunbar 0730e4f7e0 Move -fms-extensions defaulting to driver, instead of using getDefaultLangOptions.
llvm-svn: 89057
2009-11-17 07:06:20 +00:00
Daniel Dunbar d609b7bbe9 Move char-is-signed defaulting to driver, instead of using
getDefaultLangOptions.

llvm-svn: 89053
2009-11-17 06:37:03 +00:00
Edward O'Callaghan e9a58b10ad Add MIPS support to Triple for Linux and the PSP. Credit to Bruno Cardoso Lopes.
llvm-svn: 88850
2009-11-15 10:22:07 +00:00
Daniel Dunbar b9bbd54fdb Add TargetOptions and use it when constructing targets.
- This ended up being hard to factor, sorry for the large diff.

 - Some post-commit cleanup to come.

llvm-svn: 88833
2009-11-15 06:48:46 +00:00
Benjamin Kramer 5e738284d7 Move DISABLE_INLINE to the front of the decl so MSVC can parse it. Patch by Amine Khaldi!
llvm-svn: 88797
2009-11-14 16:36:57 +00:00
Chris Lattner 0fb5bbd401 do not store wchar/char16/char32/intmax width/alignment info
into TargetInfo, just derive this based on the underlying type.
This prevents them from getting out of synch, patch by Ken Dyck!

llvm-svn: 86976
2009-11-12 08:04:33 +00:00
Daniel Dunbar 979586e755 Simplifiy target feature handling by coalescing all the logic into
InitializeCompileOptions.

llvm-svn: 86826
2009-11-11 09:38:56 +00:00
Chris Lattner 5c67237ff6 teach the various targets what native integer types they have.
llvm-svn: 86395
2009-11-07 18:59:41 +00:00
Douglas Gregor 4c25ce723f Strip off the /clang/tools/clang at the end of the Subversion URL, if it's there
llvm-svn: 86195
2009-11-05 23:46:05 +00:00
John Thompson 864bf7562f Eliminate tabls
llvm-svn: 86183
2009-11-05 22:03:02 +00:00
Chris Lattner e4a8c64731 clean up integer preprocessor type definitions, patch by Ken Dyck!
llvm-svn: 86177
2009-11-05 21:21:32 +00:00
John Thompson ed4e2950bc Adding -fshort-wchar option.
llvm-svn: 86167
2009-11-05 20:14:16 +00:00
Douglas Gregor 71395fa1d5 Implement support for parsing dependent template-ids that refer to
overloaded operators, e.g.,

  p->template operator+<T>()

llvm-svn: 85989
2009-11-04 00:56:37 +00:00
Chris Lattner 3deabca934 pr5371 likely has nothing to do with this.
llvm-svn: 85862
2009-11-03 05:11:39 +00:00
Edward O'Callaghan 06231460b3 Add note to FIXME about PR5371.
llvm-svn: 85825
2009-11-02 21:25:11 +00:00
Chris Lattner c0c043903b rename getTypeSigned() -> isTypeSigned() per daniel's review.
llvm-svn: 85076
2009-10-25 22:49:18 +00:00
Daniel Dunbar 841fa8e289 Fix cmake failure trying to get SVN info for non-SVN trees.
llvm-svn: 85015
2009-10-24 20:32:58 +00:00
Sanjiv Gupta 84f0f776e9 Add a preprocessor define for adding a "near" section attribute for allowing
objects to be placed at shared memory.

llvm-svn: 85007
2009-10-24 18:08:20 +00:00
John Thompson d73d7add37 Fixed undefined behavior in pushMappings when the stack has to resize.
llvm-svn: 84924
2009-10-23 02:21:17 +00:00
Chris Lattner 72cdcacb02 add helpful methods to TargetInfo for querying builtin integer type properties,
patch by Ken Dyck!

llvm-svn: 84746
2009-10-21 06:24:21 +00:00
Chris Lattner 6720492c39 hookize wint_t's definition, patch by Edward O'Callaghan (from PR5233).
llvm-svn: 84740
2009-10-21 04:59:34 +00:00
Chris Lattner c243f299ce teach FormatDiagnostic to aggregate previously formatted arguments and
pass them down into the ArgToStringFn implementation.  This allows 
redundancy across operands to a diagnostic to be eliminated.

This isn't used yet, so no functionality change.

llvm-svn: 84602
2009-10-20 05:25:22 +00:00
Daniel Dunbar 07d0785dbb PR5218: Replace IdentifierInfo::getName with StringRef version, now that clients
are updated.

llvm-svn: 84447
2009-10-18 21:17:35 +00:00
Edward O'Callaghan 9dda8e98d4 The AuroraUX toolchain has conflicting wchar_t between the system stdlib.h header and the clang stddef.h header where clang was defining as int where we use long.
llvm-svn: 84416
2009-10-18 13:33:59 +00:00
Daniel Dunbar 1c0761d6e9 Avoid std::string thrashing in MultiKeywordSelector::getName(), and simplify.
llvm-svn: 84343
2009-10-17 18:13:02 +00:00
Daniel Dunbar e36337910f Use raw_ostream for formatting integers, and use IdentifierInfo::getNameStr
instead of getName.
 - -2 FIXMEs.

llvm-svn: 84337
2009-10-17 18:12:14 +00:00
Douglas Gregor d2eb58abac Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.

llvm-svn: 84263
2009-10-16 18:18:30 +00:00
Chris Lattner cb4e68c340 increase helpfulness of assert message.
llvm-svn: 84240
2009-10-16 02:34:51 +00:00
Anton Korobeynikov 051913bb86 Disallow arbitrary custom inline asm constraints for msp430.
llvm-svn: 84219
2009-10-15 23:17:13 +00:00
Chris Lattner 4f8a2e22c0 fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
   just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
   is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.

This fixes rdar://7115750

llvm-svn: 84077
2009-10-14 05:55:45 +00:00
Douglas Gregor e40876a50c Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.

llvm-svn: 84028
2009-10-13 21:16:44 +00:00
Chris Lattner f315471e24 fix PR4938 by recognizing % as a modifier on outputs,
previously we only recognized it on inputs.

llvm-svn: 83939
2009-10-13 04:32:07 +00:00
Mike Stump af9afe9bc9 "Someone pointed out that in my previous Targets.cpp patch I didn't
handle the long size difference for one of the Windows targets."  Patch
by John Thompson.

llvm-svn: 83592
2009-10-08 23:00:00 +00:00
Douglas Gregor 01249503fe Installation of Clang libraries and headers, from Axel Naumann!
llvm-svn: 83582
2009-10-08 22:15:31 +00:00
Douglas Gregor 1b7035da6f Provide a common set of routines in Version.h that return Subversion
branch/revision information. Use that information in the driver,
rather than one-off branch/revision computation. 

llvm-svn: 83321
2009-10-05 20:33:49 +00:00
Douglas Gregor 7550a6c186 Pre-commit commit to get URL keyword expansion for Clang version information
llvm-svn: 83319
2009-10-05 18:52:24 +00:00
Cedric Venet bc8d0dec5d Handle Eli remark on mingw __declspec macro definition
llvm-svn: 82894
2009-09-27 10:09:11 +00:00
Daniel Dunbar 3e7a723fef Factor Windows target into VS, MinGW and Cygwin variants.
- Patch by John Thompson!

llvm-svn: 82621
2009-09-23 07:31:35 +00:00
Chris Lattner d545ad1301 implement support for __builtin_eh_return_data_regno on x86-32 and x86-64.
This implements PR5034 and rdar://6836445.

llvm-svn: 82614
2009-09-23 06:06:36 +00:00
Daniel Dunbar 03184798c3 Reconcile Clang/ARM target data string with llvm-gcc (module eabi weirdness).
llvm-svn: 82578
2009-09-22 21:44:58 +00:00
Douglas Gregor ea9b03e6e2 Replace the -code-completion-dump option with
-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.

llvm-svn: 82571
2009-09-22 21:11:38 +00:00
Chris Lattner 01ce06fbbc don't stick an uninitialized 'stat' buf into the stat cache, fill it
with zeros.  This avoids a GCC warning (PR5000)

llvm-svn: 82194
2009-09-18 04:51:01 +00:00
Douglas Gregor 2436e7116b Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".

llvm-svn: 82166
2009-09-17 21:32:03 +00:00
Mike Stump faacf018a3 Fix typo.
llvm-svn: 82164
2009-09-17 21:15:00 +00:00
Daniel Dunbar 2f5c75e17d ARM: Incremental improvement to preprocessor defines.
- Based on patch by Shantonu.

llvm-svn: 82147
2009-09-17 16:21:10 +00:00
Daniel Dunbar 1da76c4e58 Add ARM register names and aliases.
- Patch by Shantonu Sen!

<rdar://problem/6922650> clang doesn't know about ARM registers for inline asm clobber lists

llvm-svn: 82132
2009-09-17 07:03:19 +00:00
Chris Lattner f7ff53d4d9 fix some ppc register name issues, patch by Richard Pennington!
llvm-svn: 82009
2009-09-16 05:05:27 +00:00
Daniel Dunbar b4091a9c6a Add TargetInfo::getABI(), and base ARM APCS vs AAPCS choice on that.
llvm-svn: 81735
2009-09-14 00:35:03 +00:00
Daniel Dunbar 125f8fb761 ARM target tweaks.
- Change TargetData string to match llvm-gcc.
 - Some -target-abi support for 'apcs-gnu', most importantly the alignment of double and long long changes.

llvm-svn: 81732
2009-09-14 00:02:24 +00:00
Daniel Dunbar 33a004e9eb Swizzle the target triple based on -mthumb, and update clang-cc to recognize
thumb-foo-bar as an ARM target.

llvm-svn: 81497
2009-09-11 01:14:50 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Benjamin Kramer 26db6481c5 Replace some instances of std::string with StringRefs.
llvm-svn: 81079
2009-09-05 09:49:39 +00:00
Daniel Dunbar a77eaeb1e6 Add basic support for -pthread.
- Patch by David Chisnall, with PCH and Darwin support mixed in.

llvm-svn: 80883
2009-09-03 04:54:28 +00:00
Douglas Gregor 053f691d5e Improve diagnostics and recovery when the nested-name-specifier of a
qualified name does not actually refer into a class/class
template/class template partial specialization. 

Improve printing of nested-name-specifiers to eliminate redudant
qualifiers. Also, make it possible to output a nested-name-specifier
through a DiagnosticBuilder, although there are relatively few places
that will use this leeway.

llvm-svn: 80056
2009-08-26 00:04:55 +00:00
Daniel Dunbar 576d90d39b Remove TargetInfo::getTargetPrefix().
llvm-svn: 79907
2009-08-24 09:54:37 +00:00
Daniel Dunbar 40165180f7 Switch TargetInfo to store an llvm::Triple.
- Primarily to discourage clients form making decisions based on the string.

llvm-svn: 79901
2009-08-24 09:10:05 +00:00
Chris Lattner 3441b4f77e API changes to match llvm ToT.
llvm-svn: 79868
2009-08-23 22:45:33 +00:00
Benjamin Kramer 89b422c118 Replace cerr with errs().
llvm-svn: 79854
2009-08-23 12:08:50 +00:00
Douglas Gregor 76d8c5725f Don't install Clang libraries.
llvm-svn: 79824
2009-08-23 05:02:18 +00:00
Sanjiv Gupta b841d1baa1 Issue an error if the user specifies parameters in a function marked as ISR.
llvm-svn: 79544
2009-08-20 17:48:52 +00:00
Eli Friedman a9c3d71b59 Add TCE target to clang; patch by Mikael Lepistö.
llvm-svn: 79462
2009-08-19 20:47:07 +00:00
Daniel Dunbar 58bc48c14e Switch to SmallString::str from SmallString::c_str.
- Several FIXMEs due to non-Twinification of IRBuilder.

llvm-svn: 79455
2009-08-19 20:04:03 +00:00
Daniel Dunbar 5232203234 Convert CreateTargetInfo to use a Triple instead of manul string munging.
- Patch by Yonggang Luo (with some formatting tweaks by Eli and myself).

llvm-svn: 79320
2009-08-18 05:47:58 +00:00
Jakob Stoklund Olesen 0de52f906d Support compilation for the blackfin back-end
llvm-svn: 79271
2009-08-17 20:08:44 +00:00
Chris Lattner 91f5ff6bce improve path handling, patch by Baptiste Lepilleur!
llvm-svn: 78824
2009-08-12 17:50:39 +00:00
Chris Lattner 859c37a5d9 use the new llvm::Triple parsing stuffola for handling darwin version #'s.
llvm-svn: 78794
2009-08-12 06:24:27 +00:00
Chris Lattner 30ba674391 fix a couple of problems with section attributes:
1. Passing something that isn't a string used to cause:
   "argument to annotate attribute was not a string literal"
  make it say "section attribute" instead.

2. Fix the location of the above message to point to the
   bad argument instead of the section token.

3. Implement rdar://4341926, by diagnosing invalid section
   specifiers in the frontend rather than letting them slip all
   the way to the assembler (a QoI win).

An example of #3 is that we used to produce something like this:

/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name
/var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.).

Daniel improved clang to use llvm_report_error, so now we got:

$ clang t.c -c
fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier
      requires a segment and section separated by a comma.

with no loc info.  Now we get:

$ clang t.c -fsyntax-only
t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment
      and section separated by a comma
int x __attribute__((section("sadf")));
                             ^

which is nice :)

llvm-svn: 78586
2009-08-10 19:03:04 +00:00
Mike Stump b0dd95d6d3 Add armv7 support.
llvm-svn: 78092
2009-08-04 19:48:52 +00:00
Anton Korobeynikov b5b703b2f7 Hook in s390x stuff into clang
llvm-svn: 76099
2009-07-16 20:09:57 +00:00
Chris Lattner 3afa3e1d91 codegen string literals using private linkage now like llvm-gcc, eliminating
some target hooks.

llvm-svn: 75895
2009-07-16 05:03:48 +00:00
Alisdair Meredith a9ad47d94c Basic support for C++0x unicode types. Support for literals will follow in an incremental patch
llvm-svn: 75622
2009-07-14 06:30:34 +00:00
Chris Lattner d1d820ed51 add netbsd support, patch by Krister Kalfridsson!
llvm-svn: 75492
2009-07-13 20:29:08 +00:00
Chris Lattner fb42a1820f add push/pop semantics for diagnostics. Patch by Louis Gerbarg!
llvm-svn: 75431
2009-07-12 21:18:45 +00:00
Duncan Sands 9cb27e9c08 Correct FreeBSD target info, fixing PR4514.
Patch by Roman Divacky.

llvm-svn: 75003
2009-07-08 13:55:08 +00:00
Sanjiv Gupta 30f95ec27d pic16 preproc defs.
llvm-svn: 74893
2009-07-07 04:42:23 +00:00
Eli Friedman 245f229df4 More tweaks to types for OpenBSD. Patch by Jonathan Gray.
llvm-svn: 74805
2009-07-05 22:31:18 +00:00