Commit Graph

579 Commits

Author SHA1 Message Date
Sebastian Redl 887d6b08fd Add a test case for tentative definitions in chained PCH. Fix a bug that completely messed up source locations and thus caused a crash whenever a diagnostic was emitted in chained PCH files.
llvm-svn: 109660
2010-07-28 21:07:02 +00:00
Douglas Gregor 81c000fb6d When remapping a virtual file, also make an entry for the file with
its absolute path on disk. Also, introduce a fun test for the
precompiled preamble, which almost works...

llvm-svn: 109470
2010-07-26 23:54:23 +00:00
Douglas Gregor 3f4bea0646 Introduce basic support for loading a precompiled preamble while
reparsing an ASTUnit. When saving a preamble, create a buffer larger
than the actual file we're working with but fill everything from the
end of the preamble to the end of the file with spaces (so the lexer
will quickly skip them). When we load the file, create a buffer of the
same size, filling it with the file and then spaces. Then, instruct
the lexer to start lexing after the preamble, therefore continuing the
parse from the spot where the preamble left off.

It's now possible to perform a simple preamble build + parse (+
reparse) with ASTUnit. However, one has to disable a bunch of checking
in the PCH reader to do so. That part isn't committed; it will likely
be handled with some other kind of flag (e.g., -fno-validate-pch).

As part of this, fix some issues with null termination of the memory
buffers created for the preamble; we were trying to explicitly
NULL-terminate them, even though they were also getting implicitly
NULL terminated, leading to excess warnings about NULL characters in
source files.

llvm-svn: 109445
2010-07-26 21:36:20 +00:00
Dan Gohman 28ade550f4 Fix namespace polution.
llvm-svn: 109440
2010-07-26 21:25:24 +00:00
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