Commit Graph

668 Commits

Author SHA1 Message Date
Chandler Carruth c3ce5840af Update remaining attribute macros to new style.
llvm-svn: 117204
2010-10-23 08:44:57 +00:00
Douglas Gregor 796d76a663 Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.

llvm-svn: 116952
2010-10-20 22:00:55 +00:00
Anders Carlsson 274a70ed7f Add a __has_attribute macro that works much like __has_feature and __has_builtin.
llvm-svn: 116906
2010-10-20 02:31:43 +00:00
Ted Kremenek c8456f8c59 Really^2 fix <rdar://problem/8361834>, this time without crashing.
Now MICache is a linked list (per the FIXME), where we tradeoff between MacroInfo objects being in MICache
and MIChainHead.  MacroInfo objects in the MICache chain are already "Destroy()'ed", so they can be reused.  When
inserting into MICache, we need to remove them from the regular linked list so that they aren't destroyed more than
once.

llvm-svn: 116869
2010-10-19 22:15:20 +00:00
Ted Kremenek 60ba93cd62 Revert most of r116862. It isn't quite the right fix for a memory leak in Preprocessor.
llvm-svn: 116864
2010-10-19 21:40:34 +00:00
Ted Kremenek e75b876fb9 Really fix: <rdar://problem/8361834> MacroInfo::AddTokenToBody() leaks memory
The problem was not the management of MacroInfo objects, but that when we recycle them
via the MICache the memory of the underlying SmallVector (within MacroInfo) was not getting
released.  This is because objects stashed into MICache simply are reused with a placement
new, and never have their destructor called.

llvm-svn: 116862
2010-10-19 21:30:15 +00:00
Ted Kremenek b865f7e025 Simplify loop. No functionality change.
llvm-svn: 116861
2010-10-19 21:30:11 +00:00
Ted Kremenek 1f1e4bdbf7 Simplify lifetime management of MacroInfo objects in Preprocessor by having the Preprocessor maintain them in a linked
list of allocated MacroInfos.  This requires only 1 extra pointer per MacroInfo object, and allows us to blow them
away in one place.  This fixes an elusive memory leak with MacroInfos (whose exact location I couldn't still figure
out despite substantial digging).

Fixes <rdar://problem/8361834>.

llvm-svn: 116842
2010-10-19 18:16:54 +00:00
Ted Kremenek 2c8028bcf4 In ~Preprocessor(), also cleanup the MacroInfo objects left-over from stray "#pragma push_macro" uses. This
fixes a potential memory leak.

llvm-svn: 116826
2010-10-19 17:40:53 +00:00
Ted Kremenek 6339f1ce2f Fix typo in comment.
llvm-svn: 116825
2010-10-19 17:40:50 +00:00
Chris Lattner 26f6c227dc allow I128 suffixes in msextensions mode just like i128 suffixes, patch
by Martin Vejnar!

llvm-svn: 116460
2010-10-14 00:24:10 +00:00
Chris Lattner 2edb926880 move logic for computing signed integer overflow when constant folding
into APInt.

llvm-svn: 116453
2010-10-13 23:46:56 +00:00
Nico Weber a6bde81bc8 Add support for UCNs for character literals
llvm-svn: 116129
2010-10-09 00:27:47 +00:00
Douglas Gregor 0bf3140424 Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me). 

llvm-svn: 116122
2010-10-08 23:50:27 +00:00
Nico Weber 9762e0a234 Add support for 4-byte UCNs like \U12345678. Warn about UCNs in c90 mode.
llvm-svn: 115743
2010-10-06 04:57:26 +00:00
Douglas Gregor 7fb25418ed Implement the C++0x "trailing return type" feature, e.g.,
auto f(int) -> int

from Daniel Wallin!

(With a few minor bug fixes from me).

llvm-svn: 115322
2010-10-01 18:44:50 +00:00
Sebastian Redl 517523014d In MeasureTokenLength, the FileLoc supplied to the lexer must point to the start of the buffer, or we risk overflow.
llvm-svn: 115117
2010-09-30 01:03:03 +00:00
Michael J. Spencer 4362a1c987 Fix coding standard mistake from my last commit.
That, and keep aKor happy :P.

llvm-svn: 114816
2010-09-27 06:34:47 +00:00
Michael J. Spencer a0a820fadb Lexer: Implement GCC's version of pragma message.
llvm-svn: 114814
2010-09-27 06:19:02 +00:00
Anders Carlsson 991285e425 Allow the use of C++0x deleted functions as an extension in C++98.
llvm-svn: 114762
2010-09-24 21:25:25 +00:00
Michael J. Spencer 09476212de Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

llvm-svn: 113817
2010-09-13 23:54:41 +00:00
Michael J. Spencer 0881f4a367 CMake: Update to use standard CMake dependency tracking facilities instead
of whatever we were using before...

llvm-svn: 113631
2010-09-10 21:13:16 +00:00
Douglas Gregor c7d6576d54 When we parse a pragma, keep track of how that pragma was originally
spelled (#pragma, _Pragma, __pragma). In -E mode, use that information
to add appropriate newlines when translating _Pragma and __pragma into
#pragma, like GCC does. Fixes <rdar://problem/8412013>.

llvm-svn: 113553
2010-09-09 22:45:38 +00:00
Douglas Gregor b2f0713ddc Clean up some of the CMake dependencies
llvm-svn: 113416
2010-09-08 21:40:53 +00:00
Chris Lattner f0b0497343 fix 7320: we can't delete a trailing space if it doesn't exist.
llvm-svn: 113125
2010-09-05 23:16:09 +00:00
Fariborz Jahanian 9e42a952d7 Use getSpelling to get original text of the
c++ operator token. (radar 8328250).

llvm-svn: 112977
2010-09-03 17:33:04 +00:00
Fariborz Jahanian 0389df4a45 Patch to allow alternative representation of c++
operators (and, or, etc.) to be used as selectors
to match g++'s behavior.

llvm-svn: 112935
2010-09-03 01:26:16 +00:00
Fariborz Jahanian 39de024e66 Prevent warning when built with assert off.
llvm-svn: 112680
2010-08-31 23:54:38 +00:00
Fariborz Jahanian abaae2b692 Some support for unicode string constants
in wide strings. radar 8360841.

llvm-svn: 112672
2010-08-31 23:34:27 +00:00
Sebastian Redl a93bb5b807 Implement __has_feature(cxx_inline_namespaces)
llvm-svn: 112671
2010-08-31 23:28:47 +00:00
Chris Lattner 0f0492e69c improve isHexaLiteral to work with escaped newlines and trigraphs,
patch by Francois Pichet!

llvm-svn: 112602
2010-08-31 16:42:00 +00:00
Chris Lattner dec7334218 silence a warning
llvm-svn: 112549
2010-08-30 23:11:03 +00:00
Alexis Hunt 3b7918625c Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

llvm-svn: 112493
2010-08-30 17:47:05 +00:00
Chris Lattner 5f183aa592 add a fixme.
llvm-svn: 112491
2010-08-30 17:11:14 +00:00
Chris Lattner 7a9e9e7d76 use 'features' instead of 'PP->getLangOptions'.
llvm-svn: 112490
2010-08-30 17:09:08 +00:00
Douglas Gregor 3cc2648b47 Now that GCC will have #pragma push/pop (in GCC 4.6), allow the
#pragma without requiring it to be in the "clang" namespace, from
Louis Gerbarg!

llvm-svn: 112484
2010-08-30 15:15:34 +00:00
Douglas Gregor 759ef23bb8 In Microsoft compatibility mode, don't parse the exponent as part of
the pp-number in a hexadecimal floating point literal, from Francois
Pichet! Fixes PR7968.

llvm-svn: 112481
2010-08-30 14:50:47 +00:00
Alexis Hunt 79eb5469e0 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

llvm-svn: 112458
2010-08-29 21:26:48 +00:00
John McCall 49039d4afb Complain if a __pragma isn't terminated.
llvm-svn: 112392
2010-08-29 01:09:54 +00:00
John McCall 89e925d78e Add support for Microsoft's __pragma in the preprocessor.
Patch by Francois Pichet!

llvm-svn: 112391
2010-08-28 22:34:47 +00:00
Douglas Gregor 33551892fa Tweak wording in an assertion, from dawn@burble.org.
llvm-svn: 112182
2010-08-26 14:07:34 +00:00
Douglas Gregor 115837041e Introduce a preprocessor code-completion hook for contexts where we
expect "natural" language and should not provide any completions,
e.g., comments, string literals, #error.

llvm-svn: 112054
2010-08-25 17:04:25 +00:00
Douglas Gregor ec00a26855 Implement code completion for preprocessor expressions and in macro
arguments.

llvm-svn: 111976
2010-08-24 22:20:20 +00:00
Douglas Gregor 127851084d Implement preprocessor code completion where a macro name is expected,
e.g., after #ifdef/#ifndef or #undef, or inside a defined <macroname>
expression in a preprocessor conditional.

llvm-svn: 111954
2010-08-24 20:21:13 +00:00
Douglas Gregor 3a7ad25eb6 Introduce basic code-completion support for preprocessor directives,
e.g., after a "#" we'll suggest #if, #ifdef, etc.

llvm-svn: 111943
2010-08-24 19:08:16 +00:00
Eli Friedman 04831926ec Detabify.
llvm-svn: 111768
2010-08-22 01:00:03 +00:00
Chris Lattner 20a2b46ca2 fix PR7943, a corner case with the GNU __VA_ARGS__ comma
swallowing extension.

llvm-svn: 111701
2010-08-21 00:27:00 +00:00
Sebastian Redl d44cd6adba More PCH -> AST renaming.
llvm-svn: 111472
2010-08-18 23:57:06 +00:00
Daniel Dunbar 211a787eaf CrashRecovery: Add #pragma clang __debug handle_crash, useful when debugging
CrashRecovery since it avoids sending a signal which may be intercepted by the
debugger.

llvm-svn: 111449
2010-08-18 23:09:23 +00:00
Chris Lattner 66b67d209e no need to pass bumppointer allocator into macroinfo::destroy
llvm-svn: 111364
2010-08-18 16:08:51 +00:00