Daniel Dunbar
1ee4b9e6d2
Fix PR5982, a refacto in checking for '=' in a -D argument.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93088 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 00:46:21 +00:00
Benjamin Kramer
a99927774d
Use MacroBuilder for TargetDefines instead of std::vector.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 17:55:51 +00:00
Benjamin Kramer
b1b5b901ca
Move MacroBuilder into Frontend/Utils.h and clean it up a bit.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 17:43:21 +00:00
Benjamin Kramer
a3d8ced7f0
Rework InitPreprocessor to use a MacroBuilder class instead of pushing around
...
std::vectors.
- MacroBuilder wraps a raw_ostream so it can easily write to any buffer
supported by raw_ostream.
- MacroBuilder's method take Twines for easy string concatenation (this was done
with sprintf and temporary buffers before).
- Targets still use std::vector as they don't have access to the builder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 16:17:37 +00:00
Kovarththanan Rajaratnam
3e82f8ac70
Switch UndefineBuiltinMacro() over to using StringRef
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93049 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 09:31:32 +00:00
Kovarththanan Rajaratnam
8746e4e381
Switch DefineBuiltinMacro() over to using StringRef
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 09:27:11 +00:00
Kovarththanan Rajaratnam
7d0eed6ed7
Convert from char pointer to char array
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 18:11:14 +00:00
Kovarththanan Rajaratnam
a66a31940a
Tigthen scope of local char array
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 16:01:54 +00:00
Steve Naroff
fdd6aaf162
Integrate the following from the 'objective-rewrite' branch:
...
http://llvm.org/viewvc/llvm-project?view=rev&revision=70926
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:29:41 +00:00
Daniel Dunbar
baac10380c
Fix two more diagnostic-on-stderr instances that thought they could hide from me -- they thought wrong.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 09:14:12 +00:00
Douglas Gregor
057e567f1b
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90329 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:12:28 +00:00
Douglas Gregor
2973c0eff4
Move file-remapping logic into InitPreprocesor. No functionality change
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 16:32:41 +00:00
Rafael Espindola
0259d20ba1
Exit the command line into <built-in> instead of going directly from the command line to the input file.
...
We passed <built-in> on the way in, so we should pass it again on the way out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 18:28:16 +00:00
Ken Dyck
3e945c8cd8
Define __SIG_ATOMIC_WIDTH__ for use in stdint.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 15:41:04 +00:00
Ken Dyck
63e6561343
Define __WCHAR_WIDTH__ for use in stdint.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 15:47:58 +00:00
Ken Dyck
7635d2151d
Add __WINT_WIDTH__ to paramaterize the limits of WINT_MIN and WINT_MAX in
...
stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 14:16:57 +00:00
Ken Dyck
7484e5d8e2
Add __SIZE_WIDTH__ to eventually replace __SIZE_TYPE__ in stdint.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 13:42:09 +00:00
Ken Dyck
8241d73c64
Restore __INTMAX_TYPE__, __UINTMAX_TYPE__, __PTRDIFF_TYPE__, and
...
__INTPTR_TYPE__ as the last is used in the test/CodeGen/const-init.c and all
could potentially be in use in the wild. My apologies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89345 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 13:18:59 +00:00
Ken Dyck
cf2f71f91d
Remove __PTRDIFF_TYPE__ as it is no longer needed by stdint.h. It has been
...
replaced with __PTRDIFF_WIDTH__.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 12:37:14 +00:00
Ken Dyck
d00c75179c
Add __PTRDIFF_WIDTH__ macro to eventually replace __PTRDIFF_TYPE__ in stdint.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 12:21:52 +00:00
Ken Dyck
ed116e95bc
Remove __INTPTR_TYPE__ as it is no longer needed by stdint.h, which uses
...
__INTPTR_WIDTH__ instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 12:15:31 +00:00
Ken Dyck
d896e1ad86
Predefine __INTPTR_WIDTH__ for future use in stdint.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 20:05:48 +00:00
Ken Dyck
eec59a7364
Remove the __INTMAX_TYPE__ and __UINTMAX_TYPE__ built-in macros as they are no
...
longer used by stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 19:51:06 +00:00
Ken Dyck
186696bee3
Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros in
...
stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 13:52:57 +00:00
Daniel Dunbar
049d3a06ea
Simplify PreprocessorOptions, it doesn't need abstracted field access.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:52:41 +00:00
Ken Dyck
eef22efce8
Parameterize the constant-generating macros in stdint.h with new built-in
...
__INTn_C_SUFFIX__ macros that are defined for types with corresponding
constant suffixes (i.e. long and long long).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 16:36:33 +00:00
Chris Lattner
dcdd2a064a
Generalize stdint.h for non-8-bit-multiple types, patch by
...
Ken Dyck!
"This adds definitions for types of 8-bit multiples
from 8 to 64 to stdint.h and rationalizes the selection of types
for the exact-width definitions in InitPreprocessor.cpp."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 08:08:27 +00:00
Chris Lattner
9184646509
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!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86976 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 08:04:33 +00:00
Daniel Dunbar
c7162937a4
Tweak PCH -include handling to make sure it matches the name as would be present
...
in the predefines buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 23:58:53 +00:00
Daniel Dunbar
961c76ea8d
Always initialize the header search object as part of InitializePreprocessor;
...
not doing this has little to no utility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:42 +00:00
Daniel Dunbar
b6d1cc84d1
PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:53:43 +00:00
Daniel Dunbar
8863b985f1
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
...
filenames.
Also, move InitializePreprocessor to Utils.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 04:20:15 +00:00
Chris Lattner
9099e7bcda
clean up integer preprocessor type definitions, patch by Ken Dyck!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 21:21:32 +00:00
Daniel Dunbar
938963f076
InitializePreprocessor cannot fail.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:13:15 +00:00
Daniel Dunbar
468fe24619
Move -undef flag into PreprocessorInitOptions
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-04 21:13:02 +00:00
Chris Lattner
e6113de52d
Implement support for the -undef command line option, patch by
...
Roman Divacky! PR5363
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-03 19:50:27 +00:00
Chris Lattner
47c06eea60
clean up namespace.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-02 21:48:09 +00:00
Chris Lattner
c883770665
simplify intmax setup, patch by Ken Dyck!
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-29 04:54:24 +00:00
Chris Lattner
e64ef80363
hookize wint_t's definition, patch by Edward O'Callaghan (from PR5233).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 04:59:34 +00:00
John Thompson
24ee804962
Work-around wchar_t and __pragma problem in VC headers
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:12:00 +00:00
Rafael Espindola
f759df06d9
Move the "needs exception support" logic to clang. This also fixes
...
-fno-exceptions in C++ code. We used to always define __EXCEPTIONS in
C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-01 13:33:33 +00:00
Fariborz Jahanian
d9a1db3a4d
Non fragile ABI for GNU runtime. Patch bu David Chisnall.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-10 21:48:21 +00:00
Mike Stump
1eb4433ac4
Remove tabs, and whitespace cleanups.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Daniel Dunbar
b8b844b925
Don't use '%ll', this doesn't workin on Win32.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 19:23:49 +00:00
Eli Friedman
666479b24b
Define _GNU_SOURCE in C++ mode so that clang works with GNU libstdc++.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-27 22:01:41 +00:00
Chris Lattner
d57a7ef925
API changes to match llvm ToT.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 22:45:33 +00:00
Douglas Gregor
36dd131b49
Predefine __cplusplus to the right value (199711L), except when in GNU mode.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-06 04:09:28 +00:00
Ryan Flynn
07ef804f91
define __STDC_VERSION__ processor token for c94
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76514 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:07:02 +00:00
Eli Friedman
3c7b6e46c5
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;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 03:36:11 +00:00
Bill Wendling
4ebe3e4c81
Make the StackProtector bitfield use enums instead of obscure numbers.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 23:01:01 +00:00
Bill Wendling
45483f7a1b
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 07:36:13 +00:00
Chris Lattner
7478bbfea8
__APPLE_CC__ should only be set when building for darwin targets.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 00:43:21 +00:00
Eli Friedman
ae96a9637a
PR4388: get rid of an extra # line directive; in addition to being
...
unnecessary, this was causing issues for assembler-with-cpp mode, which
doesn't process the directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 09:57:52 +00:00
Eli Friedman
abc4e32603
Misc minor fixes for clang for the Windows target.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 06:11:14 +00:00
Eli Friedman
15b91764d0
Move CharIsSigned from TargetInfo to LangOptions.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 07:05:05 +00:00
Eli Friedman
2de4feeef2
Move a couple Darwin-specific defines into getDarwinDefines.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 23:00:29 +00:00
Chris Lattner
810dc54e1c
DefineBuiltinMacro is always passed two args, remove the defaulted third
...
one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 16:47:09 +00:00
Duncan Sands
63682f9c64
Compile fix needed by the solaris system gcc.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 14:28:20 +00:00
Eli Friedman
2665a75c16
Add IEEE quad support to DefineFloatMacros.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 03:50:01 +00:00
Eli Friedman
bf22be630e
PR4247: Widen the buffer slightly so it can hold all the definitions for
...
PPC double double.
(No testcase because no normal target uses the format at the moment.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 02:03:39 +00:00
Fariborz Jahanian
34e65770ad
This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
...
compiled with -fobjc-sender-dependent-dispatch. This is used in AOP, COP, implementing object
planes, and a few other things.
Patch by David Chisnall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 20:17:16 +00:00
Eli Friedman
f086e3bef1
Remove unused parameter.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71996 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 07:39:39 +00:00
Chris Lattner
dcdecf4a77
Fix processing of -Ufoo to not inject "#undef foo 1" into the predefines
...
buffer. This caused exciting nonsense like this:
$ clang t.c -fsyntax-only -UMACRO
In file included from <built-in>:104:
<command line>:1:14: warning: extra tokens at end of #undef directive [-Wextra-tokens]
#undef MACRO 1
^
//
1 diagnostic generated.
rdar://6891800
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71860 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 16:08:43 +00:00
Daniel Dunbar
1e7c6b6787
Add another workaround for -include.
...
- If we don't find a file looking relative to the current working
directory, fall back to header search. This is closer to what would
happen if the lookup was starting from right directory in the first
place (except it will find files in the directory of the main
source file, which I *think* should not be found).
- PR3992.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 08:53:01 +00:00
Chris Lattner
3936024941
Fix rdar://6814950 - stdint.h isn't "-pedantic -std=c89" clean,
...
by marking the predefines buffer as a system header. The problem
with stdint is that it was getting problems like this:
/Volumes/Projects/cvs/llvm/Debug/lib/clang/1.0/include/stdint.h:43:9: warning: 'long long' is an extension when C99 mode is not enabled
typedef __INT64_TYPE__ int64_t;
^
<built-in>:73:29: note: instantiated from:
#define __INT64_TYPE__ long long
^
We correctly silence warnings in system headers, but only if the
spelling location of the token came from the system header. This is
designed so that if you use a system macro in your code that you don't
get punished for its definition. This is all cool except that the
predefines buffer wasn't considered a system header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 03:42:19 +00:00
Chris Lattner
32b325fb33
this time with more workingness.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69669 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 06:06:09 +00:00
Chris Lattner
62f86c4555
fix massive testsuite failures from Alexei's patch due to inverted logic.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 06:00:24 +00:00
Chris Lattner
e116ccf140
Split preprocessor initialization logic out of clang-cc into
...
libfrontend. Patch by Alexei Svitkine!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 05:40:52 +00:00