Ted Kremenek
34ddec630c
Predefine the '__clang_analyzer__' macro when using '-analyze'.
...
llvm-svn: 104742
2010-05-26 21:36:54 +00:00
Douglas Gregor
6602c25c0c
Add Clang version inspection macros. Fixes PR6681.
...
llvm-svn: 102686
2010-04-30 02:51:06 +00:00
Chris Lattner
678eaa90ab
fix PR6936: don't generate line marker directives when preprocessing
...
.S files. "# 123" is passed through as-is, not treated as a line
marker in this mode. No testcase, because it would be nasty and isn't
worth it.
llvm-svn: 102391
2010-04-26 22:08:10 +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
Douglas Gregor
d2b896ab69
Only predefine the macro _GNU_SOURCE in C++ mode when we're on a
...
platform that typically uses glibc. Fixes a Boost.Thread compilation
failure.
llvm-svn: 101450
2010-04-16 06:31:05 +00:00
Douglas Gregor
89a56c561f
When given unsaved files in clang_createTranslationUnitFromSourceFile,
...
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.).
llvm-svn: 97296
2010-02-27 01:32:48 +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
Douglas Gregor
aa98ed9a07
Extend clang_createTranslationUnitFromSourceFile() to support creating
...
translation units that include unsaved files.
llvm-svn: 94258
2010-01-23 00:14:00 +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
Daniel Dunbar
415763612a
Fix an invalid Twine use spotty by abbeyj, it isn't safe to use Twine
...
temporaries (this is one reason I'm nervous about propagating their use beyond
particularly performance critical places).
llvm-svn: 93981
2010-01-20 06:09:53 +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
Daniel Dunbar
d281a7146a
Fix PR5982, a refacto in checking for '=' in a -D argument.
...
llvm-svn: 93088
2010-01-10 00:46:21 +00:00
Benjamin Kramer
2d6fda3205
Use MacroBuilder for TargetDefines instead of std::vector.
...
llvm-svn: 93058
2010-01-09 17:55:51 +00:00
Benjamin Kramer
3f6323dea5
Move MacroBuilder into Frontend/Utils.h and clean it up a bit.
...
llvm-svn: 93057
2010-01-09 17:43:21 +00:00
Benjamin Kramer
f65e959035
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.
llvm-svn: 93051
2010-01-09 16:17:37 +00:00
Kovarththanan Rajaratnam
e8ed5be89f
Switch UndefineBuiltinMacro() over to using StringRef
...
llvm-svn: 93049
2010-01-09 09:31:32 +00:00
Kovarththanan Rajaratnam
2f14619d89
Switch DefineBuiltinMacro() over to using StringRef
...
llvm-svn: 93048
2010-01-09 09:27:11 +00:00
Kovarththanan Rajaratnam
49c8da95a3
Convert from char pointer to char array
...
llvm-svn: 92923
2010-01-07 18:11:14 +00:00
Kovarththanan Rajaratnam
b53c7d4d9d
Tigthen scope of local char array
...
llvm-svn: 92917
2010-01-07 16:01:54 +00:00
Steve Naroff
f0df20a5ba
Integrate the following from the 'objective-rewrite' branch:
...
http://llvm.org/viewvc/llvm-project?view=rev&revision=70926
llvm-svn: 90596
2009-12-04 21:29:41 +00:00
Daniel Dunbar
6dac935b1f
Fix two more diagnostic-on-stderr instances that thought they could hide from me -- they thought wrong.
...
llvm-svn: 90442
2009-12-03 09:14:12 +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
6ae34abd1b
Move file-remapping logic into InitPreprocesor. No functionality change
...
llvm-svn: 90322
2009-12-02 16:32:41 +00:00
Rafael Espindola
f8a04a1d6e
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.
llvm-svn: 90250
2009-12-01 18:28:16 +00:00
Ken Dyck
adc8511bc8
Define __SIG_ATOMIC_WIDTH__ for use in stdint.h.
...
llvm-svn: 89597
2009-11-22 15:41:04 +00:00
Ken Dyck
0138b9e1db
Define __WCHAR_WIDTH__ for use in stdint.h.
...
llvm-svn: 89353
2009-11-19 15:47:58 +00:00
Ken Dyck
a1f677c3d1
Add __WINT_WIDTH__ to paramaterize the limits of WINT_MIN and WINT_MAX in
...
stdint.h.
llvm-svn: 89348
2009-11-19 14:16:57 +00:00
Ken Dyck
575128656e
Add __SIZE_WIDTH__ to eventually replace __SIZE_TYPE__ in stdint.h.
...
llvm-svn: 89346
2009-11-19 13:42:09 +00:00
Ken Dyck
9b25f781c5
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.
llvm-svn: 89345
2009-11-19 13:18:59 +00:00
Ken Dyck
f982fc0b23
Remove __PTRDIFF_TYPE__ as it is no longer needed by stdint.h. It has been
...
replaced with __PTRDIFF_WIDTH__.
llvm-svn: 89344
2009-11-19 12:37:14 +00:00
Ken Dyck
056efe0fc7
Add __PTRDIFF_WIDTH__ macro to eventually replace __PTRDIFF_TYPE__ in stdint.h.
...
llvm-svn: 89342
2009-11-19 12:21:52 +00:00
Ken Dyck
cc11129fda
Remove __INTPTR_TYPE__ as it is no longer needed by stdint.h, which uses
...
__INTPTR_WIDTH__ instead.
llvm-svn: 89340
2009-11-19 12:15:31 +00:00
Ken Dyck
24cfcf15c3
Predefine __INTPTR_WIDTH__ for future use in stdint.h.
...
llvm-svn: 89231
2009-11-18 20:05:48 +00:00
Ken Dyck
fa01168a5c
Remove the __INTMAX_TYPE__ and __UINTMAX_TYPE__ built-in macros as they are no
...
longer used by stdint.h.
llvm-svn: 89230
2009-11-18 19:51:06 +00:00
Ken Dyck
c0c98291e0
Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros in
...
stdint.h.
llvm-svn: 89203
2009-11-18 13:52:57 +00:00
Daniel Dunbar
d6ea9028e7
Simplify PreprocessorOptions, it doesn't need abstracted field access.
...
llvm-svn: 89047
2009-11-17 05:52:41 +00:00
Ken Dyck
2dc8d5fa3e
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).
llvm-svn: 88914
2009-11-16 16:36:33 +00:00
Chris Lattner
55c9877b66
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."
llvm-svn: 86977
2009-11-12 08:08:27 +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
732ef8aefd
Tweak PCH -include handling to make sure it matches the name as would be present
...
in the predefines buffer.
llvm-svn: 86903
2009-11-11 23:58:53 +00:00
Daniel Dunbar
2856ae444b
Always initialize the header search object as part of InitializePreprocessor;
...
not doing this has little to no utility.
llvm-svn: 86883
2009-11-11 21:44:42 +00:00
Daniel Dunbar
de02f63945
PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
...
llvm-svn: 86757
2009-11-10 23:53:43 +00:00
Daniel Dunbar
00f8a397c6
Rename PreprocessorInitOptions to PreprocessorOptions for consistency, and fix
...
filenames.
Also, move InitializePreprocessor to Utils.h.
llvm-svn: 86335
2009-11-07 04:20:15 +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
Daniel Dunbar
181aaee165
InitializePreprocessor cannot fail.
...
llvm-svn: 86048
2009-11-04 21:13:15 +00:00
Daniel Dunbar
b27ec09a7e
Move -undef flag into PreprocessorInitOptions
...
llvm-svn: 86047
2009-11-04 21:13:02 +00:00
Chris Lattner
e9d7d78ab3
Implement support for the -undef command line option, patch by
...
Roman Divacky! PR5363
llvm-svn: 85932
2009-11-03 19:50:27 +00:00
Chris Lattner
3fab58d867
clean up namespace.
...
llvm-svn: 85826
2009-11-02 21:48:09 +00:00
Chris Lattner
d0952749f7
simplify intmax setup, patch by Ken Dyck!
...
llvm-svn: 85481
2009-10-29 04:54:24 +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
John Thompson
1faca9e0fb
Work-around wchar_t and __pragma problem in VC headers
...
llvm-svn: 84227
2009-10-16 01:12:00 +00:00
Rafael Espindola
00a665751d
Move the "needs exception support" logic to clang. This also fixes
...
-fno-exceptions in C++ code. We used to always define __EXCEPTIONS in
C++.
llvm-svn: 83199
2009-10-01 13:33:33 +00:00
Fariborz Jahanian
2cde203392
Non fragile ABI for GNU runtime. Patch bu David Chisnall.
...
llvm-svn: 81462
2009-09-10 21:48:21 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Daniel Dunbar
fe07aecd37
Don't use '%ll', this doesn't workin on Win32.
...
llvm-svn: 80933
2009-09-03 19:23:49 +00:00
Eli Friedman
80110179f4
Define _GNU_SOURCE in C++ mode so that clang works with GNU libstdc++.
...
llvm-svn: 80289
2009-08-27 22:01:41 +00:00
Chris Lattner
3441b4f77e
API changes to match llvm ToT.
...
llvm-svn: 79868
2009-08-23 22:45:33 +00:00
Douglas Gregor
3f4d51bb04
Predefine __cplusplus to the right value (199711L), except when in GNU mode.
...
llvm-svn: 78283
2009-08-06 04:09:28 +00:00
Ryan Flynn
ed73cac647
define __STDC_VERSION__ processor token for c94
...
llvm-svn: 76514
2009-07-21 00:07:02 +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
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
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
Eli Friedman
b188455eb2
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.
llvm-svn: 73382
2009-06-15 09:57:52 +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
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
Chris Lattner
5e4702db61
DefineBuiltinMacro is always passed two args, remove the defaulted third
...
one.
llvm-svn: 72868
2009-06-04 16:47:09 +00:00
Duncan Sands
f4063513d0
Compile fix needed by the solaris system gcc.
...
llvm-svn: 72772
2009-06-03 14:28:20 +00:00
Eli Friedman
57406b2783
Add IEEE quad support to DefineFloatMacros.
...
llvm-svn: 72314
2009-05-23 03:50:01 +00:00
Eli Friedman
f98fc352b8
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.)
llvm-svn: 72310
2009-05-23 02:03:39 +00:00
Fariborz Jahanian
a4404f21d1
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.
llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Eli Friedman
174c310967
Remove unused parameter.
...
llvm-svn: 71996
2009-05-18 07:39:39 +00:00
Chris Lattner
4579b76ff6
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
llvm-svn: 71860
2009-05-15 16:08:43 +00:00
Daniel Dunbar
66cb01313b
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.
llvm-svn: 69794
2009-04-22 08:53:01 +00:00
Chris Lattner
ed462a8d44
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.
llvm-svn: 69770
2009-04-22 03:42:19 +00:00
Chris Lattner
6af6edb8b7
this time with more workingness.
...
llvm-svn: 69669
2009-04-21 06:06:09 +00:00
Chris Lattner
e08c43a3b0
fix massive testsuite failures from Alexei's patch due to inverted logic.
...
llvm-svn: 69666
2009-04-21 06:00:24 +00:00
Chris Lattner
2f5693f62d
Split preprocessor initialization logic out of clang-cc into
...
libfrontend. Patch by Alexei Svitkine!
llvm-svn: 69664
2009-04-21 05:40:52 +00:00