Douglas Gregor
c8dfe5ece0
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.).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97296 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-27 01:32:48 +00:00
Daniel Dunbar
b2987d159a
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 18:49:11 +00:00
Douglas Gregor
4db64a461c
Extend clang_createTranslationUnitFromSourceFile() to support creating
...
translation units that include unsaved files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 00:14:00 +00:00
Chandler Carruth
103b71c37a
Move the MacroBuilder utilitiy to its own header. Update references.
...
Comments and/or improvements to the documentation are welcome.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93982 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:13:02 +00:00
Daniel Dunbar
066515feea
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93981 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:09:53 +00:00
Fariborz Jahanian
7d957472ef
Predefine __weak attribute when doing objective-c
...
rewriting for any target. (refixes radar 7530235).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 18:51:17 +00:00
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