Commit Graph

534 Commits

Author SHA1 Message Date
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
Eli Friedman e3aa454e2f Per PR4506, fix the type of size_t on OpenBSD.
llvm-svn: 74795
2009-07-05 18:47:56 +00:00
Eli Friedman fb36b02591 Add an intermediate typedef for __builtin_va_tag to make it a bit easier
to deal with for AST pretty-printing/rewriting.  Patch by Abramo 
Bagnara.

llvm-svn: 74752
2009-07-03 00:45:06 +00:00
Douglas Gregor c05d2a11d7 Two fixes to make Clang build on Visual C++ (again), from Alisdair Meredith.
llvm-svn: 74606
2009-07-01 15:12:53 +00:00
Eli Friedman 2857ccbaa7 Fix for PR4192: fix the definition of int64_t on x86_64 Linux.
Note that I'm guessing that *BSD and Solaris do the same thing as Linux 
here, but it's quite possible I'm wrong; if the following testcase 
gives an error on x86-64 with gcc for any of those operating systems, please
tell me:

#include <stdint.h>

int64_t x; long x;

llvm-svn: 74583
2009-07-01 03:36:11 +00:00
Torok Edwin b2b37c62d0 Reapply r74532, and inherit from OSTargetInfo instead of from Target.
'make test' passes now.

llvm-svn: 74539
2009-06-30 17:10:35 +00:00
Torok Edwin 4e0541649b Revert 74532 till I figure out why it breaks a bunch of tests.
llvm-svn: 74536
2009-06-30 17:00:25 +00:00
Torok Edwin 45d60b5bc3 Use templates instead of creating a new class for each OS/Target combination.
This unifies all the targets supported by an OS into a template.
It also cleans up the differences between the darwin targets.
Also __LP64__ wasn't needed for *BSD, since x86-64 target defines it anyway.

llvm-svn: 74532
2009-06-30 16:30:17 +00:00
Chris Lattner c61089a6c2 Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.
This is simple enough, but then I thought it would be nice to make PrintingPolicy
get a LangOptions so that various things can key off "bool" and "C++" independently.
This spiraled out of control.  There are many fixme's, but I think things are slightly
better than they were before.

One thing that can be improved: CFG should probably have an ASTContext pointer in it,
which would simplify its clients.

llvm-svn: 74493
2009-06-30 01:26:17 +00:00
Daniel Dunbar 86e35b3aba Use true/false instead of 1/0.
llvm-svn: 74479
2009-06-29 23:58:47 +00:00
Daniel Dunbar 302ab13b1a Don't define __KPRINTF_ATTRIBUTE__ unconditionally on OpenBSD.
llvm-svn: 74467
2009-06-29 22:45:37 +00:00
Daniel Dunbar 10de9e6602 OpenBSD support.
- Patch by Jonathan Gray!

llvm-svn: 74453
2009-06-29 20:52:51 +00:00
Bill Wendling 1835107ed0 Make the StackProtector bitfield use enums instead of obscure numbers.
llvm-svn: 74414
2009-06-28 23:01:01 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Nate Begeman 8b68d6fb83 OpenCL 1.0 Support: support "bool, true, false" tokens when compiling for OpenCL
llvm-svn: 74224
2009-06-25 23:25:15 +00:00
Argyrios Kyrtzidis 0e5ecbda69 Fix column checking for SourceManager::getLocation().
llvm-svn: 74194
2009-06-25 18:22:16 +00:00
Chris Lattner 46be2e1557 fix the type of wchar_t for windows, PR4417
llvm-svn: 74083
2009-06-24 17:12:15 +00:00
Daniel Dunbar 349db7bbcd Fix warning when building w/o asserts.
llvm-svn: 74020
2009-06-23 23:09:58 +00:00
Argyrios Kyrtzidis 33661d9f16 Introduce SourceManager::ísBeforeInTranslationUnit() which can compare 2 source locations and determine which one comes before the other, relative to the translation unit.
llvm-svn: 74014
2009-06-23 22:01:48 +00:00
Chris Lattner 2fe5b26414 __APPLE_CC__ should only be set when building for darwin targets.
llvm-svn: 73934
2009-06-23 00:43:21 +00:00
Argyrios Kyrtzidis 0152c6cbca In SourceManager::createFileID missed setting ContentCache's FirstFID in another place.
llvm-svn: 73931
2009-06-23 00:42:06 +00:00
Argyrios Kyrtzidis 69c2e0635a Slight modification to column checking inside SourceManager::getLocation().
llvm-svn: 73826
2009-06-20 08:40:15 +00:00
Argyrios Kyrtzidis 88f663c04d Introduce SourceManager::getLocation() to get a source location out of a "file:line:column" triplet.
llvm-svn: 73823
2009-06-20 08:09:57 +00:00
Chris Lattner 651a221cc2 follow-on to my patch: some targets (like sparc) do not
have target-specific builtins, and do not set the count.
Just default to 0 for these targets.

llvm-svn: 73510
2009-06-16 17:27:50 +00:00
Chris Lattner 4ef49c1d6e my refactoring of builtins changed target-specific builtins to only be
registered when PCH wasn't being used.  We should always install (in BuiltinInfo)
information about target-specific builtins, but we shouldn't register any builtin
identifier infos.  This fixes the build of apps that use PCH and target specific
builtins together.

llvm-svn: 73492
2009-06-16 16:18:48 +00:00
Douglas Gregor 15e08d8567 Base SFINAE error suppression counting on the class of an error, not
its (possibly-remapped) diagnostics. Thanks, Chris!

llvm-svn: 73390
2009-06-15 16:52:15 +00:00
Douglas Gregor 33834516f3 Update LLVM.
Implement support for C++ Substitution Failure Is Not An Error
(SFINAE), which says that errors that occur during template argument
deduction do *not* produce diagnostics and do not necessarily make a
program ill-formed. Instead, template argument deduction silently
fails. This is currently implemented for template argument deduction
during matching of class template partial specializations, although
the mechanism will also apply to template argument deduction for
function templates. The scheme is simple:

  - If we are in a template argument deduction context, any diagnostic
    that is considered a SFINAE error (or warning) will be
    suppressed. The error will be propagated up the call stack via the
    normal means.
  - By default, all warnings and errors are SFINAE errors. Add the
    NoSFINAE class to a diagnostic in the .td file to make it a hard
    error (e.g., for access-control violations).

Note that, to make this fully work, every place in Sema that emits an
error *and then immediately recovers* will need to check
Sema::isSFINAEContext() to determine whether it must immediately
return an error rather than recovering.

llvm-svn: 73332
2009-06-14 07:33:30 +00:00
Chris Lattner 15ba94987a Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc.  This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.

llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Chris Lattner 5abdec7978 move the various builtins stuff from libast to libbasic. This
fixes a layering violation in lib/Basic/Targets.cpp.

llvm-svn: 73318
2009-06-14 01:05:48 +00:00
Daniel Dunbar eed62b7c4b Add stack alignment to x86_64 target data.
- <rdar://problem/6948443> WARNING: Linking two modules of different data
   layouts!

llvm-svn: 73093
2009-06-08 22:39:13 +00:00
Eli Friedman ebb9e4dc4d Minor tweaks to the Windows target.
llvm-svn: 73083
2009-06-08 21:16:17 +00:00
Eli Friedman cf432d3c7b PR4346: add "R" asm register constraint.
llvm-svn: 73081
2009-06-08 20:45:44 +00:00
Eli Friedman aa27a87ab3 Misc minor fixes for clang for the Windows target.
llvm-svn: 73050
2009-06-08 06:11:14 +00:00
Zhongxing Xu aaa86d07a0 Remove dead code: 'NewEntry' is not used.
llvm-svn: 73027
2009-06-07 11:18:14 +00:00
Eli Friedman 9ffd4a9b96 Move CharIsSigned from TargetInfo to LangOptions.
llvm-svn: 72928
2009-06-05 07:05:05 +00:00
Eli Friedman fd4b1559db Move a couple Darwin-specific defines into getDarwinDefines.
llvm-svn: 72900
2009-06-04 23:00:29 +00:00
Eli Friedman 3d2c8fd3a6 Back out r72764; I should have looked more carefully before committing
this.  The correct replacement for "Y" and "Yt" is "x".

llvm-svn: 72765
2009-06-03 10:41:42 +00:00
Eli Friedman ffc8748faa PR3678: Add support for "Yt" asm register constraint.
llvm-svn: 72764
2009-06-03 10:33:05 +00:00
Sanjiv Gupta 7c72007e2a Add floating point details to PIC16 Target.
llvm-svn: 72713
2009-06-02 04:43:46 +00:00
Eli Friedman 20da71e3b6 Add a couple missing ARM defines.
llvm-svn: 72583
2009-05-29 19:00:15 +00:00
Eli Friedman 7942674be0 A few more tweaks for Solaris; please correct me if it's wrong somehow.
llvm-svn: 72240
2009-05-22 01:12:57 +00:00
Douglas Gregor 4871c4739d Improve target support for Solaris.
llvm-svn: 72237
2009-05-21 23:51:30 +00:00
Daniel Dunbar 70f924df8a Avoid potential out-of-bounds access in SourceManager::getLineNumber.
- Chris, please see added FIXMEs.

llvm-svn: 72019
2009-05-18 17:30:52 +00:00
Eli Friedman 678d3bac03 Targets without long long should reduce the size of intmax_t
accordingly.

llvm-svn: 71966
2009-05-16 23:30:57 +00:00
Anton Korobeynikov 2f910827eb Provide dummy va_list typedef for msp430
llvm-svn: 71233
2009-05-08 18:24:57 +00:00
Daniel Dunbar f9d90275f9 Handle -march for the LLVM recognized cpu names.
- x86 target feature handling should not be feature complete, even if
   the code quality is lacking.

llvm-svn: 71123
2009-05-06 21:56:32 +00:00
Daniel Dunbar bb36aed06b More x86 target feature support.
- Apologies for the extremely gross code duplication, I want to get
   this working and then decide how to get this information out of the
   back end.

 - This replaces -m[no-]sse4[12] by -m[no-]sse4, it appears gcc
   doesn't distinguish them?

 - -msse, etc. now properly disable/enable related features.

 - Don't always define __SSE3__...

 - The main missing functionality bit here is that we don't initialize
   the features based on the CPU for all -march options.

llvm-svn: 71117
2009-05-06 21:07:50 +00:00
Daniel Dunbar e5ae096bf8 Tweak x86 -mcpu defaults.
- Default to yonah on Darwin (to get SSE3).

 - Default to Pentium4 (32-bit) and x86-64 (64-bit) on
   non-Darwin. Welcome to the 21st century.

llvm-svn: 71069
2009-05-06 04:58:14 +00:00
Chris Lattner dbcc5ca57f Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.

llvm-svn: 71064
2009-05-06 04:33:31 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Anton Korobeynikov a0f5437c03 Hook msp430 in
llvm-svn: 70774
2009-05-03 13:43:08 +00:00
Anton Korobeynikov 9d026dd985 Whitespace cleanup
llvm-svn: 70773
2009-05-03 13:42:53 +00:00
Chris Lattner 195f88386c when creating custom warning diagnostics, do not attempt to map
them with -Werror.  Custom diags cannot be mapped, and this makes
-Werror cause a determinstic crash for the checker and other
clients of the custom diagnostics machinery.  rdar://6816191

llvm-svn: 70639
2009-05-02 19:34:21 +00:00
Eli Friedman 2b680b43e9 Simplify the scheme used for keywords, and change the classification
scheme to be more useful.

The new scheme introduces a set of categories that should be more 
readable, and also reflects what we want to consider as an extension 
more accurately.  Specifically, it makes the "what is a keyword" 
determination accurately reflect whether the keyword is a GNU or 
Microsoft extension.

I also introduced separate flags for keyword aliases; this is useful 
because the classification of the aliases is mostly unrelated to the 
classification of the original keyword.

This patch treats anything that's in the implementation 
namespace (prefixed with "__", or "_X" where "X" is any upper-case 
letter) as a keyword without marking it as an extension.  This is 
consistent with the standards in that an implementation is allowed to define 
arbitrary extensions in the implementation namespace without violating 
the standard. This gets rid of all the nasty "extension used" warnings 
for stuff like __attribute__ in -pedantic mode.  We still warn for 
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we 
could add additional information to the keyword table.

This also removes processing for the unused "Boolean" language option; 
such an extension isn't supported on any other C implementation, so I 
don't see any point to adding it.

The changes to test/CodeGen/inline.c are required because previously, we 
weren't actually disabling the "inline" keyword in -std=c89 mode.

I'll remove Boolean and NoExtensions from LangOptions in a follow-up 
commit.

llvm-svn: 70281
2009-04-28 03:13:54 +00:00
Douglas Gregor 0bc1293584 Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file.

llvm-svn: 70251
2009-04-27 21:28:04 +00:00
Douglas Gregor c504683237 Implement caching of stat() calls for precompiled headers, which is
essentially the same thing we do with pretokenized headers. stat()
caching improves performance of the Cocoa-prefixed "Hello, World" by
45%.

llvm-svn: 70223
2009-04-27 18:38:38 +00:00
Douglas Gregor 258ae54a5d Load most of the source manager's information lazily from the PCH
file. In particular, only eagerly load source location entries for
files and for the predefines buffer. Other buffers and
macro-instantiation source location entries are loaded lazily.

With the Cocoa-prefixed "Hello, World", we only load 815/26555 source
location entities. This halves the amount of user time we spend in
this "Hello, World" program with -fsyntax-only (down to .007s).

This optimization is part 1 of 2 for the source manager. This
eliminates most of the user time in loading a PCH file. We still spend
too much time initialize File structures (especially in the calls to
stat), so we need to either make the loading of source location
entries for files lazy or import the stat cache from the PTH
implementation.

llvm-svn: 70196
2009-04-27 06:38:32 +00:00
Douglas Gregor 70091b8f43 Some fixes for PCH (de-)serialization of Objective-C AST nodes:
- Deal with the Receiver/ClassInfo shared storage in ObjCMessageExpr
  - Implement PCH support for ImplicitParamDecl
  - Fix the handling of the body of an ObjCMethodDecl
  - Several cast -> cast_or_null fixes
  - Make Selector::getIdentifierInfoForSlot work for 1-argument, NULL
  selectors.
  - Make Selector::getAsString() work with NULL selectors.
  - Fix the names of VisitObjCAtCatchStmt and VisitObjCAtFinallyStmt
  in the PCH reader and writer; these were never getting called.

At this point, all of the pch-test tests pass for C and Objective-C.

llvm-svn: 70163
2009-04-26 22:20:50 +00:00
Chris Lattner 4c92b51089 in a tied operand, don't copy over the name or constraint string, just the flags.
llvm-svn: 70137
2009-04-26 18:05:25 +00:00
Chris Lattner c16d476b30 pull operands names "[foo]" into ConstraintInfo.
llvm-svn: 70136
2009-04-26 17:57:12 +00:00
Chris Lattner c3f4c7b1c5 pull the constraint string into the ConstraintInfo struct
instead of passing it around in addition to it.

llvm-svn: 70135
2009-04-26 17:19:08 +00:00
Chris Lattner d9725f7041 change TargetInfo::ConstraintInfo to be a struct that contains
the enum along with some other data.

llvm-svn: 70114
2009-04-26 07:16:29 +00:00
Douglas Gregor 99734e7669 Lazily load the controlling macros for all of the headers known in the
PCH file. In the Cocoa-prefixed "Hello, World" benchmark, this takes
us from reading 503 identifiers down to 37 and from 470 macros down to
4. It also results in an 8% performance improvement.

llvm-svn: 70094
2009-04-25 23:30:02 +00:00
Chris Lattner 0dc102624f some arm triples have weird characters in them, just fuzzy match
on armv* to be more compatible

llvm-svn: 69864
2009-04-23 04:22:04 +00:00
Douglas Gregor 48db39dc90 Remove the serialization code that predates precompiled
headers. Future approaches to (de-)serializing ASTs will be based on
the PCH infrastructure.

llvm-svn: 69828
2009-04-22 21:45:53 +00:00
Chris Lattner 63660175f8 Add missing dependency, patch by Jason Haslam!
llvm-svn: 69819
2009-04-22 18:59:57 +00:00
Sanjiv Gupta 4c5dfd3c45 Pass and return aggregate types directly to function calls.
llvm-svn: 69668
2009-04-21 06:01:16 +00:00
Daniel Dunbar 69a79b1a60 Don't crash in the diagnostic printer if we happen to get passed a
null string / identifier.

llvm-svn: 69575
2009-04-20 06:13:16 +00:00
Chris Lattner c6fafed04c move group twiddling options into Diagnostic.cpp instead of
Warnings.cpp.  Warnings.cpp now doesn't need to #include
tblgen produced output directly.

llvm-svn: 69559
2009-04-19 22:34:23 +00:00
Eli Friedman d88c8a104f Add target property for whether thread-local storage is supported.
Let me know if I messed up for some target.  Note that for Windows, we 
should be able to support it (MSVC supports "__declspec(thread)"), but 
I'm pretty sure LLVM doesn't know how to generate the correct code.

llvm-svn: 69552
2009-04-19 21:38:35 +00:00
Chris Lattner 6df41af7fb actually just do this on all x86 targets, it won't hurt
non-glibc ones.

llvm-svn: 69528
2009-04-19 17:32:33 +00:00
Chris Lattner 4997b8ef98 Define __NO_MATH_INLINES on linux/x86 so that we don't get inline
functions in glibc header files that use FP Stack inline asm which the
backend can't deal with (PR879).

This "fixes" PR3970 for linux.  Other affected systems should do similar
things.  Maybe this should just go to the general i386/x86-64 sections?

llvm-svn: 69527
2009-04-19 17:29:50 +00:00
Chris Lattner 2d49eed816 optimize and comment GetDiagInfo.
llvm-svn: 69273
2009-04-16 06:13:46 +00:00
Chris Lattner 6c440329f1 merge several scattered tables into StaticDiagInfo.
llvm-svn: 69272
2009-04-16 06:07:15 +00:00
Chris Lattner 6a64cc6776 Implement Diagnostic::getWarningOptionForDiag with information from tblgen,
this implements -fdiagnostics-show-option in clang-cc.

llvm-svn: 69271
2009-04-16 06:00:24 +00:00
Chris Lattner a538967177 tblgen is now passing diagnostic group information in the .inc file, ignore it everywhere.
llvm-svn: 69269
2009-04-16 05:52:14 +00:00
Chris Lattner 22cb818913 implement framework for -fdiagnostics-show-option, but tblgen isn't
passing down the right info yet.

llvm-svn: 69268
2009-04-16 05:44:38 +00:00
Chris Lattner b8e73158e1 move handling of -pedantic and -pedantic-errors into Diagnostics,
out of Warnings.cpp.  This simplifies warnings.cpp and makes it more
efficient.

llvm-svn: 69266
2009-04-16 05:04:32 +00:00
Chris Lattner f9150bac01 arrange for -Wno-error=foo warnings to be immune to -Werror as
they are supposed to be.

llvm-svn: 69265
2009-04-16 04:32:54 +00:00
Chris Lattner 411c0ffe5d change mappings to distinguish between "unset", "set by the user" and
"set to the default value".

llvm-svn: 69264
2009-04-16 04:12:40 +00:00
Chris Lattner d9ecb8e279 fix some out of bounds array access problems, which manifest particularly
spectacularly when built for x86-64.

llvm-svn: 69197
2009-04-15 18:48:23 +00:00
Chris Lattner 2fe292076e move {'s
llvm-svn: 69179
2009-04-15 17:13:42 +00:00
Chris Lattner e6c831deb2 Make diagnostic class explicit in the diag record instead of
implicit from its parenting.  Now that diag mapping is 
explicit, eliminate the fatal and extwarn classes.

llvm-svn: 69177
2009-04-15 16:56:26 +00:00
Chris Lattner 1b595624a8 Tblgen now passes the default mapping explicitly, instead of having it
be tied to the diag class.  This requires an LLVM tree update.

llvm-svn: 69175
2009-04-15 16:44:12 +00:00
Chris Lattner e007de3b9a Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping.  In the new scheme, -Wfoo or -Wno-foo or 
-Werror=foo all override the -pedantic options, and __extension__ 
robustly silences all extension diagnostics in their scope.

An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array.  This also 
substantially simplifies Diagnostic::getDiagnosticLevel.

OTOH, this temporarily introduces some "macro intensive" code in 
Diagnostic.cpp.  This will be addressed in a later patch.

llvm-svn: 69154
2009-04-15 07:01:18 +00:00
Mike Stump d73e4419f5 Fixup whitespacing.
llvm-svn: 69055
2009-04-14 18:24:37 +00:00
Douglas Gregor 4c7626e7b6 Include the SourceManager's line table in the PCH file. We can now
properly cope with #line directives in PCH files.

llvm-svn: 68963
2009-04-13 16:31:14 +00:00
Douglas Gregor a07ebc5b95 Factor the internals of SourceManager (specially, LineTableInfo) into a separate Internals header. No functionality change
llvm-svn: 68960
2009-04-13 15:31:25 +00:00
Daniel Dunbar 497ff13243 Support -miphoneos-version-min in clang-cc.
- Patch by Shantonu Sen (with a minor tweak to split out
   getDarwin{OSX,IPhoneOS}Defines)!

 - <rdar://problem/6776277> Need clang-cc/ccc-analyzer support for
   -miphoneos-version-min

llvm-svn: 68815
2009-04-10 19:52:24 +00:00
Chris Lattner 14a7f39733 Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.

llvm-svn: 68625
2009-04-08 18:24:34 +00:00
Chris Lattner 8bc98d9bed remove fixme!
llvm-svn: 68589
2009-04-08 03:47:39 +00:00
Mike Stump 9d54bd77c0 Add basic support for arm static analysis checking. Radar 6699395
llvm-svn: 68582
2009-04-08 02:07:04 +00:00
Chris Lattner 2a5c0a3688 Fariborz points out that weak is now defined to the attribute even
in C mode.

llvm-svn: 68520
2009-04-07 16:50:40 +00:00
Chris Lattner c2d140156c The __weak and __strong defines are common to all darwin targets
and are even set in C mode.  As such, move them to Targets.cpp.

__OBJC_GC__ is also darwin specific, but seems reasonable to always
define it when in objc-gc mode.

This fixes rdar://6761450

llvm-svn: 68494
2009-04-07 04:48:21 +00:00
Anton Korobeynikov 6953ef2de3 Provide sema proper values of maximal number of arguments passed in registers.
llvm-svn: 68413
2009-04-03 23:38:25 +00:00
Daniel Dunbar fd6cfcffa2 Add target hook for setting symbol prefix and section of unicode
string literals.

llvm-svn: 68363
2009-04-03 00:57:44 +00:00
Douglas Gregor 0f4cc3f728 Fix a little typo that was killing de-serialization
llvm-svn: 68354
2009-04-03 00:25:09 +00:00
Douglas Gregor 17bbaed164 Resynchronize Decl/VarDecl serialization code with the structures
llvm-svn: 68346
2009-04-02 23:40:00 +00:00
Steve Naroff 29cae66bde Add ConvertUTF module from http://www.unicode.org/Public/PROGRAMS/CVTUTF.
#ifdef'd out the 5 conversion routines that we don't currently need.

Still need a bit more work in GetAddrOfConstantCFString(). Added a FIXME to indicate this.

Expect to remove the FIXME today...

llvm-svn: 68208
2009-04-01 15:50:34 +00:00
Daniel Dunbar 08b216abf1 Add Target hooks for IRgen of [cf]string literals.
- Notably, set section on cfstring literal string data (for now, this
   is done everywhere because it matches what we were already doing
   for the CFString data itself)

 - <rdar://problem/6599098> [irgen] linker requires objc string data
   to go into cstring

llvm-svn: 68160
2009-03-31 23:42:16 +00:00
Eli Friedman 32ca82a450 Fix the default for intptr_t on *BSD x86-32 and Windows. Slight cleanup
by moving the general case to the generic x86-32 target.

llvm-svn: 68015
2009-03-29 20:31:09 +00:00
Daniel Dunbar c53305fd42 Ad FreeBSD ARM target info.
- Patch by Ed Schoeten!

llvm-svn: 67527
2009-03-23 16:09:04 +00:00
Douglas Gregor da17bd34e7 Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation
backtrace when needed.

llvm-svn: 67413
2009-03-20 22:48:49 +00:00
Chris Lattner 1e1c0b9fd3 refactor some code, fixing a problem discovered by the dragonfly bsd people, where
clang was defining "i386" even when in non-gnu mode.

llvm-svn: 67378
2009-03-20 16:06:38 +00:00
Chris Lattner a1321f1632 pass langoptions around.
llvm-svn: 67376
2009-03-20 15:55:34 +00:00
Chris Lattner 4ba73aa0c2 pass LangOptions into TargetInfo::getTargetDefines, so that targets
can have language-specific defines.

llvm-svn: 67375
2009-03-20 15:52:06 +00:00
Sebastian Redl 90b6edda75 Bindir and Win32 builds work, so switch to .inc files. Leave the .def files in the tree for a day or so longer.
llvm-svn: 67346
2009-03-19 23:18:26 +00:00
Douglas Gregor 19367f54e2 Allow notes to be printed following a fatal error, then suppress any
diagnostics following those notes. 

Make exceeding the template instantiation depth a fatal error.

Thanks to Daniel for pointing out the problem!

llvm-svn: 67320
2009-03-19 18:55:06 +00:00
Douglas Gregor 23d75bb326 Build system changes to use TableGen to generate the various
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:

  - We don't remove or use the current ".def" files. Instead, for now,
    we just make sure that we're building the ".inc" files.
  - Fixed CMake makefiles to run TableGen and build the ".inc" files
    when needed. Tested with both the Xcode and Makefile generators
    provided by CMake, so it should be solid.
  - Fixed normal makefiles to handle out-of-source builds that involve
    the ".inc" files.

I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.

llvm-svn: 67058
2009-03-16 23:06:59 +00:00
Sebastian Redl 4ae9b126fe Revert the switch to the tablegen diags. It fails for seperate objdir builds and cmake builds, and I have no clue what to do about it. Revisit this after someone with a clue about the build systems has looked at it.
llvm-svn: 67009
2009-03-14 15:58:54 +00:00
Sebastian Redl 51e037e3c4 Switch diagnostics from .def to tablegen files. Please validate the Windows build.
llvm-svn: 67007
2009-03-14 12:00:12 +00:00
Daniel Dunbar 4f495980c4 Add Diagnostic files for Frontend and move a couple errors over.
- Notably, clang now exits with an error if it can't find a
   file. This flushed out a bug in the CGColorSpace.c test case. :)

llvm-svn: 66789
2009-03-12 10:14:16 +00:00
Daniel Dunbar c0b3e95a1a Driver: Use standard Diagnostic interface for diagnostics.
llvm-svn: 66786
2009-03-12 08:55:43 +00:00
Chris Lattner 1ac3c9292f Clear all the linetable state in clear(), fixing problems
with "clang t.i s.i" where the .i files contain line markers.
rdar://6667812

llvm-svn: 66619
2009-03-11 01:09:52 +00:00
Douglas Gregor 4ea568f213 Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.

As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.

llvm-svn: 66557
2009-03-10 18:03:33 +00:00
Daniel Dunbar 4095d89532 Remove some now-unneeded calls to llvm::errs().flush().
llvm-svn: 66555
2009-03-10 18:00:19 +00:00
Ted Kremenek 3ceb7caf1c Add FullSourceLoc::getDecomposedLoc.
llvm-svn: 66522
2009-03-10 05:13:43 +00:00
Ted Kremenek 22988cf493 Revert my last couple patches until I can get them to not make the tests fail.
llvm-svn: 66317
2009-03-07 01:47:10 +00:00
Ted Kremenek a44b4f987c Teach Diagnostic about Selector.
llvm-svn: 66314
2009-03-07 01:36:13 +00:00
Ted Kremenek 0666a6ce70 Selector: (changes made after discussing this more with Steve Naroff)
- Make Selector::getAsIdentifierInfo() private.  Using IdentifierInfo* in
  Selector is an implementation detail that clients shouldn't think about.
- Modify diagnostic emission in Sema::ProcessPropertyDecl to not use
  Selector::getAsIdentifierInfo() (which could crash when IdentifierInfo* is
  null) and instead use Selector::getAsString().
- Tidy up Selector::getAsString() implementation.

llvm-svn: 66313
2009-03-07 01:22:02 +00:00
Ted Kremenek 5f080b43fa Handle null IdentifierInfo* in Selector::getAsString().
llvm-svn: 66307
2009-03-06 23:36:28 +00:00
Chris Lattner bd61a95481 Include information about compound statements when crashing in sema or the
parser.  For example, we now print out:

0.	t.c:5:10: in compound statement {}
1.	t.c:3:12: in compound statement {}
2.	clang t.c -fsyntax-only

llvm-svn: 66108
2009-03-05 00:00:31 +00:00
Chris Lattner 1a84994c46 allocate MultiKeywordSelector's out of a bump pointer allocator instead of malloc.
This has two advantages 1) no more leaking them, 2) fewer calls to malloc.

This changes us from calling malloc 3685/1390/883/2974/1185 times respectively on
16/20/24/28/32 byte objects when parsing cocoa.h with pth and -disable-free to
calling it 2816/1020/702/2903/1168 times each respectively.

llvm-svn: 66017
2009-03-04 05:35:38 +00:00
Chris Lattner 5c3529634a implement support for propagating *features* down to the code generator
and defining target-specific macros based on them (like __SSE3__ and 
friends).  After extensive discussion with Daniel, this work will need
driver support, which will translate things like -msse3 into a -mattr 
feature.  Until this work is done, the code in clang.cpp is disabled and
the X86TargetInfo ctor still defaults to SSE2.  With these two things
changed, this code will work.  PR3634

llvm-svn: 65966
2009-03-03 19:56:18 +00:00
Chris Lattner 96e43578fc Add plumbing to support programatically defining __SSE2__ and friends,
even though we still hard code sse2 for now.  No support for 3dnow or sse4a,
but someone could add that if they desired.

llvm-svn: 65886
2009-03-02 22:40:39 +00:00
Chris Lattner ecd49037ec minor cleanups to target-specific #defines, no functionality change.
llvm-svn: 65885
2009-03-02 22:27:17 +00:00
Chris Lattner c25d8a7e30 improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)
llvm-svn: 65884
2009-03-02 22:20:04 +00:00
Anders Carlsson 5843635b37 TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).
llvm-svn: 65696
2009-02-28 17:11:49 +00:00
Douglas Gregor 96977da72c Clean up and document code modification hints.
llvm-svn: 65641
2009-02-27 17:53:17 +00:00
Douglas Gregor 87f95b0a6a Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

  - Insert some new code (a text string) at a particular source
    location
  - Remove the code within a given range
  - Replace the code within a given range with some new code (a text
    string)

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

  template<int I> class B { };
  B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
  B<1000 >> 2> *b1;
         ^
    (        )


Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).

llvm-svn: 65570
2009-02-26 21:00:50 +00:00
Fariborz Jahanian 30b3ac5e9e Minor refactoring.
llvm-svn: 65414
2009-02-24 23:38:42 +00:00
Fariborz Jahanian 240f2b7851 patch for two things.
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.

llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Chris Lattner d0b80c8c75 add support for amd64-*, patch by Brooks Davis!
llvm-svn: 65124
2009-02-20 17:04:14 +00:00
Chris Lattner cf868c458c replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-)

llvm-svn: 65083
2009-02-19 23:53:20 +00:00
Chris Lattner 810d330cd3 Fix a long standard problem with clang retaining "too much" sugar
information about types.  We often print diagnostics where we say 
"foo_t" is bad, but the user doesn't know how foo_t is declared 
(because it is a typedef).  Fix this by expanding sugar when present
in a diagnostic (and not one of a few special cases, like vectors).

Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

After:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

llvm-svn: 65081
2009-02-19 23:45:49 +00:00
Chris Lattner a6f037cee1 add an accessor.
llvm-svn: 64760
2009-02-17 08:39:06 +00:00
Chris Lattner 8ad52d5068 add an accessor.
llvm-svn: 64758
2009-02-17 08:04:48 +00:00
Chris Lattner 9ee10ea535 fix a minor bug with my previous patch
llvm-svn: 64747
2009-02-17 06:52:20 +00:00
Chris Lattner d2a2c13474 fix notes so that they are always filtered with the same logic
as the last non-note diagnostic that preceeded them.  This ensures
that diagnostics in main files which have notes with locations in 
system headers get all the bits and pieces emitted or not in a 
unit.  This fixes PR3215.

llvm-svn: 64746
2009-02-17 06:49:55 +00:00
Douglas Gregor 9eebd9709a Supply the header corresponding to a library builtin as a separate argument to the LIBBUILTIN macro
llvm-svn: 64676
2009-02-16 21:58:21 +00:00
Chris Lattner f52c0b261c add a new SourceManager::getInstantiationRange helper method.
llvm-svn: 64606
2009-02-15 21:26:50 +00:00
Chris Lattner 9dc9c206d3 track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full
range of the macro that got replaced.  For object-like macros, this doesn't
change anything.  For _Pragma and function-like macros, this means we track
the locations of the ')'.

This is required for PR3579 because apparently GCC uses the line of the ')'
of a function-like macro as the location to expand __LINE__ to.

llvm-svn: 64601
2009-02-15 20:52:18 +00:00