Commit Graph

498 Commits

Author SHA1 Message Date
Douglas Gregor 9291ab6d80 Don't expand tabs when computing the offset from the code-completion column
llvm-svn: 90881
2009-12-08 21:45:46 +00:00
Steve Naroff 04bc01833e Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=80043

llvm-svn: 90860
2009-12-08 16:38:12 +00:00
Eli Friedman be6f4cffca Get rid of some diagnostics that don't follow our rules for -pedantic
diagnostics (specifically, that any extension in a compiler-reserved namespace
shouldn't trigger a diagnostic).

llvm-svn: 90826
2009-12-08 02:22:26 +00:00
Daniel Dunbar 58ecb2ab51 Unbreak and add test case for r90276, a situation in which getBuffer is expected to fail.
Also, update SourceManager.h doxyments for getBuffer() to reflect reality.

llvm-svn: 90701
2009-12-06 09:19:25 +00:00
Daniel Dunbar 1776679e71 Change Preprocessor::EnterSourceFile to make ErrorStr non-optional, clients should be forced to deal with error conditions.
llvm-svn: 90700
2009-12-06 09:19:12 +00:00
Chris Lattner 6aab73137a minor tidy.
llvm-svn: 90543
2009-12-04 06:14:03 +00:00
Douglas Gregor 5f49883488 Minor cleanup to the code-completion-point logic suggested by Chris.
llvm-svn: 90459
2009-12-03 17:05:59 +00:00
Ted Kremenek 5ef26fb4fd Add 'has_feature(cxx_exceptions)' to allow code to determine via preprocessor logic if C++ exceptions are enabled.
llvm-svn: 90378
2009-12-03 01:34:15 +00:00
Ted Kremenek c3fe01943f Rename has_feature(rtti) to has_feature(cxx_rtti) for clarity.
llvm-svn: 90376
2009-12-03 01:31:28 +00:00
Ted Kremenek 4bc256ec9d Add "has_feature" support for C++ RTTI.
llvm-svn: 90368
2009-12-03 01:02:35 +00:00
Douglas Gregor 53ad6b94b0 Extend the source manager with the ability to override the contents of
files with the contents of an arbitrary memory buffer. Use this new
functionality to drastically clean up the way in which we handle file
truncation for code-completion: all of the truncation/completion logic
is now encapsulated in the preprocessor where it belongs
(<rdar://problem/7434737>).

llvm-svn: 90300
2009-12-02 06:49:09 +00:00
Chris Lattner ed3b360290 pass the reason for failure up from MemoryBuffer and report it
in diagnostics when we fail to open a file.  This allows us to
report things like:

$ clang test.c -I.
test.c:2:10: fatal error: error opening file './foo.h': Permission denied
#include "foo.h"
         ^

llvm-svn: 90276
2009-12-01 22:52:33 +00:00
Chris Lattner 710bb87147 Fix PR5633 by making the preprocessor handle the case where we can
stat a file but where mmaping it fails.  In this case, we emit an
error like:
t.c:1:10: fatal error: error opening file '../../foo.h'

instead of "cannot find file".

llvm-svn: 90110
2009-11-30 04:18:44 +00:00
Nuno Lopes 0e5d13e025 remove stall comment
llvm-svn: 90080
2009-11-29 17:07:16 +00:00
Benjamin Kramer 337e3a5fea Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.
llvm-svn: 90044
2009-11-28 19:45:26 +00:00
Kovarththanan Rajaratnam 930de0aeaf Cleanup llvm/Support/Compiler.h include in header files
llvm-svn: 90040
2009-11-28 16:08:10 +00:00
Nuno Lopes baa1bc44af cleanup parsing of MS integer suffixes a little. this fixes PR5616
btw, I believe that isMicrosoftInteger can go away; it's not read anywhere

llvm-svn: 90036
2009-11-28 13:37:52 +00:00
Benjamin Kramer 5e738284d7 Move DISABLE_INLINE to the front of the decl so MSVC can parse it. Patch by Amine Khaldi!
llvm-svn: 88797
2009-11-14 16:36:57 +00:00
Daniel Dunbar bf410c6fc2 Add static version of Preprocessor::getSpelling.
llvm-svn: 88732
2009-11-14 01:20:48 +00:00
Daniel Dunbar 1b4441915a Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.
llvm-svn: 87087
2009-11-13 05:51:54 +00:00
Daniel Dunbar 1a54e3fbb9 Switch PTHManager to using diagnostics for most errors.
Also, always give errors on a token-cache PTH failure.

llvm-svn: 86939
2009-11-12 02:53:48 +00:00
Douglas Gregor c998409cce Remove an overly-eager assertion when replacing tokens with an
annotation token, because some of the tokens we're annotating might
not be in the set of cached tokens (we could have consumed them
unconditionally).

Also, move the tentative parsing from ParseTemplateTemplateArgument
into the one caller that needs it, improving recovery.

llvm-svn: 86904
2009-11-12 00:03:40 +00:00
Daniel Dunbar 0c6c930f05 Allow Preprocessor to take ownership of the HeaderSearch object. I think it should probably always own the header search object, but I'm not sure...
llvm-svn: 86882
2009-11-11 21:44:21 +00:00
Daniel Dunbar 93097b3906 Add Diagnostic::Report method for reporting diagnostics without a location.
llvm-svn: 86760
2009-11-10 23:55:23 +00:00
Daniel Dunbar 07dcd8b9d8 Make LookUpIdentifierInfo const. This makes the Identifiers table mutable and is
a little fuzzy, but conceptually it's just uniquing the identifier.

Chris, please review. I debated splitting into const/non-const versions where
the const one propogated constness to the resulting IdentifierInfo*.

llvm-svn: 86106
2009-11-05 01:53:52 +00:00
Daniel Dunbar f539bfeb4d StringRefize Preprocessor::getIdentifierInfo.
llvm-svn: 86105
2009-11-05 01:53:39 +00:00
Daniel Dunbar d0ba0e6108 Kill PreprocessorFactory, which was both morally repugnant and totally unused.
llvm-svn: 86076
2009-11-04 23:56:25 +00:00
John Thompson ac0b098d4d Added __has_include and __has_include_next.
llvm-svn: 85834
2009-11-02 22:28:12 +00:00
John Thompson b535352681 Re-arranged some internal functions for coming __has_include changes.
llvm-svn: 85589
2009-10-30 13:49:06 +00:00
Chandler Carruth a3f084ce16 Update location of DataTypes.h to reflect move in LLVM with r85086.
llvm-svn: 85087
2009-10-26 01:37:10 +00:00
Daniel Dunbar 2c422dc9ca Move clients to use IdentifierInfo::getNameStart() instead of getName()
llvm-svn: 84436
2009-10-18 20:26:12 +00:00
Daniel Dunbar f8502d50f7 Switch to llvm::HashString.
llvm-svn: 84375
2009-10-17 23:52:28 +00:00
Douglas Gregor d2eb58abac Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this
change is that we can now generate a PCH/AST file when including
another PCH file; in the future, the chain of stat caches will likely
be useful with multiple levels of PCH files.

llvm-svn: 84263
2009-10-16 18:18:30 +00:00
Chris Lattner a3d4f16b12 Teach Lexer::MeasureTokenLength to be able to measure the
length of comment tokens.  Patch by Abramo Bagnara!

llvm-svn: 84100
2009-10-14 15:04:18 +00:00
Mike Stump c99c022841 This fixes support for complex literals, reworked to avoid a goto, and
to add a flag noting the presence of a Microsoft extension suffix (i8,
i16, i32, i64).  Patch by John Thompson.

llvm-svn: 83591
2009-10-08 22:55:36 +00:00
Douglas Gregor 01249503fe Installation of Clang libraries and headers, from Axel Naumann!
llvm-svn: 83582
2009-10-08 22:15:31 +00:00
Douglas Gregor ea9b03e6e2 Replace the -code-completion-dump option with
-code-completion-at=filename:line:column

which performs code completion at the specified location by truncating
the file at that position and enabling code completion. This approach
makes it possible to run multiple tests from a single test file, and
gives a more natural command-line interface.

llvm-svn: 82571
2009-09-22 21:11:38 +00:00
Douglas Gregor 3545ff43f4 Refactor and simplify the CodeCompleteConsumer, so that all of the
real work is performed within Sema. Addresses Chris's comments, but
still retains the heavyweight list-of-multimaps data structure.

llvm-svn: 82459
2009-09-21 16:56:56 +00:00
Douglas Gregor 2436e7116b Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".

llvm-svn: 82166
2009-09-17 21:32:03 +00:00
Benjamin Kramer 26ddfee3b2 PR4991: Properly remove trailing newline from __TIMESTAMP__.
Replace strcpy with memcpy while at it.

llvm-svn: 82043
2009-09-16 13:10:04 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
David Chisnall 5778fce141 Updated GNU runtime non-fragile ABI.
Added -fconstant-string-class= option.
Added __has_feature() test for non-fragile ABI.

llvm-svn: 80591
2009-08-31 16:41:57 +00:00
Benjamin Kramer 89b422c118 Replace cerr with errs().
llvm-svn: 79854
2009-08-23 12:08:50 +00:00
Douglas Gregor 76d8c5725f Don't install Clang libraries.
llvm-svn: 79824
2009-08-23 05:02:18 +00:00
Erick Tryzelaar b90731117c Update lexer to work with the new APFloat string parsing.
llvm-svn: 79211
2009-08-16 23:36:28 +00:00
Daniel Dunbar a444cc2fa8 CharLiteralParser::IsMultiChar was sometimes uninitialized.
llvm-svn: 77420
2009-07-29 01:46:05 +00:00
Nuno Lopes bd2cd92907 fix segfault (because of erasing after the vector boundaries) when the cached token position is at the end
llvm-svn: 77159
2009-07-26 16:36:45 +00:00
Ted Kremenek 3e808edac9 Lexically order files in CMakeLists.txt files.
llvm-svn: 75832
2009-07-15 21:08:41 +00:00
Alisdair Meredith ed28f6e433 Fix the build
llvm-svn: 75627
2009-07-14 08:10:06 +00:00
Alisdair Meredith a9ad47d94c Basic support for C++0x unicode types. Support for literals will follow in an incremental patch
llvm-svn: 75622
2009-07-14 06:30:34 +00:00