Commit Graph

1974 Commits

Author SHA1 Message Date
Eli Friedman d62d51c84d Some minor updates to the Linux search path handling for Slackware. Patch by Will Dietz. PR10692.
llvm-svn: 138753
2011-08-29 18:56:43 +00:00
Fariborz Jahanian 3a039e339f objective-c: Treat top-level objective-c declarations
, such as list of forward @class decls, in a DeclGroup
node. Deal with its consequence throught clang. This
is in preparation for more Sema work ahead. // rdar://8843851.
Feel free to reverse if it breaks something important
and I am unavailable.

llvm-svn: 138709
2011-08-27 20:50:59 +00:00
Douglas Gregor c67bcd5b65 Remove the -import-module option. It's no longer useful
llvm-svn: 138681
2011-08-27 00:03:05 +00:00
Douglas Gregor 081425343b Introduce support for a simple module import declaration, which
loads the named module. The syntax itself is intentionally hideous and
will be replaced at some later point with something more
palatable. For now, we're focusing on the semantics:
  - Module imports are handled first by the preprocessor (to get macro
  definitions) and then the same tokens are also handled by the parser
  (to get declarations). If both happen (as in normal compilation),
  the second one is redundant, because we currently have no way to
  hide macros or declarations when loading a module. Chris gets credit
  for this mad-but-workable scheme.
  - The Preprocessor now holds on to a reference to a module loader,
  which is responsible for loading named modules. CompilerInstance is
  the only important module loader: it now knows how to create and
  wire up an AST reader on demand to actually perform the module load.
  - We search for modules in the include path, using the module name
  with the suffix ".pcm" (precompiled module) for the file name. This
  is a temporary hack; we hope to improve the situation in the
  future.

llvm-svn: 138679
2011-08-26 23:56:07 +00:00
Chad Rosier ba3df1d3ca [driver] Add -mglobal-merge/-mno-global-merge machine options to enable/disable merging of
globals during codegen.
Fixes <rdar://problem/10017909>.

llvm-svn: 138612
2011-08-26 00:26:29 +00:00
Douglas Gregor 2ed0ee1ace Eliminate the -chained-pch flag and all of the frontend and libclang options associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file
llvm-svn: 138597
2011-08-25 22:54:01 +00:00
Douglas Gregor 36db4f9602 Remove the Chaining argument from the PCH/module generator. It's no longer used
llvm-svn: 138596
2011-08-25 22:35:51 +00:00
Douglas Gregor 69f74f80db Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.

llvm-svn: 138595
2011-08-25 22:30:56 +00:00
Argyrios Kyrtzidis 7aecbc7661 Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may be
out-of-sync how a file is compiled. Patch by Matthias Kleine!

llvm-svn: 138580
2011-08-25 20:39:19 +00:00
Axel Naumann 744f121e5b Reset FirstID (first diagnostic's file ID) to allow for invocations of the VerifyDiagnosticsClient on several input files.
llvm-svn: 138434
2011-08-24 13:36:19 +00:00
Ted Kremenek fbbdcedc2e Implement '-Weverything', which enables all warnings except those explicitly mapped to be ignored.
Currently this includes -pedantic warnings as well; we'll need to consider whether these should
be included.

This works as expected with -Werror.

Test cases were added to Sema/warn-unused-parameters.c, but they should probably be broken off into
their own test file.

llvm-svn: 137910
2011-08-18 01:12:56 +00:00
Douglas Gregor 29cc642f68 In the AST file format, eliminate the CHAINED_METADATA record. Instead,
all AST files have a normal METADATA record that has the same form
regardless of whether we refer to a chained PCH or any other kind of
AST file.

Introduce the IMPORTS record, which describes all of the AST files
that are imported by this AST file, and how (as a module, a PCH file,
etc.). Currently, we emit at most one entry to this record, to support
chained PCH.

llvm-svn: 137869
2011-08-17 21:07:30 +00:00
Nico Weber 80806a7b91 Add Gentoo gcc 4.3.4 include paths
llvm-svn: 137834
2011-08-17 17:55:30 +00:00
NAKAMURA Takumi 203f87ccb1 [MSVC] Fix a warning C4334 "'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)".
llvm-svn: 137803
2011-08-17 01:46:16 +00:00
Nico Weber c687cae11d Accept -x objc++-cpp-output as an alias for -x objective-c++-cpp-output
This is the ObjC++ version of r129201. It's for example needed to use
ccache with clang.

llvm-svn: 137560
2011-08-13 19:03:50 +00:00
Jonathan D. Turner 0248f57d59 Wire up -import-module to run ReadAST for each module loaded.
llvm-svn: 136987
2011-08-05 22:17:03 +00:00
Douglas Gregor 3f35bb2d15 Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>.

llvm-svn: 136911
2011-08-04 20:04:59 +00:00
Douglas Gregor 2c595adf2e When performing code completion after at @interface, allow both
already-defined and forward-declared results. Already-defined results
are fine because they could be the start of a category. Fixes
<rdar://problem/9811691>.

llvm-svn: 136559
2011-07-30 06:55:39 +00:00
Douglas Gregor f4016fdf71 On Darwin, libc++ may be installed alongside the compiler in
lib/c++/v1. Look there first, before falling back to the normal
/usr/include/c++/v1. <rdar://problem/9866149>

llvm-svn: 136507
2011-07-29 20:21:18 +00:00
Ted Kremenek 73665188fc Really remove FlatStoreManager and BasicStoreManager, this time from the driver. Also remove associated tests. Sorry for the messy commits; this is the result of a botched Git merge.
llvm-svn: 136422
2011-07-28 23:08:16 +00:00
Douglas Gregor 9f93e38aaf Introduce the "-index-header-map" option, to give special semantics
for quoted header lookup when dealing with not-yet-installed
frameworks. Fixes <rdar://problem/9824020>.

llvm-svn: 136331
2011-07-28 04:45:53 +00:00
Argyrios Kyrtzidis 08a2bfd230 Cut down the number of open/close system calls for output files.
For PCH files, have only one open/close for temporary + rename to be safe from race conditions.
For all other output files open/close the output file directly.

Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374.

llvm-svn: 136315
2011-07-28 00:45:10 +00:00
Richard Trieu 82398f9cd6 Add template instantiations to the output of -ast-dump.
llvm-svn: 136306
2011-07-28 00:19:05 +00:00
Jonathan D. Turner b2b0823d00 This patch extends the previous patch by starting to incorporate more functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager).
llvm-svn: 136107
2011-07-26 18:21:30 +00:00
Chandler Carruth aa63153ff7 Rename SourceManager (and InstantiationInfo) isMacroArgInstantiation API
to isMacroArgExpansion.

llvm-svn: 136053
2011-07-26 03:03:00 +00:00
Chandler Carruth d48db2115a Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135969
2011-07-25 21:09:52 +00:00
Chandler Carruth 42f35f9cd2 Rename getInstantiationColumnNumber to getExpansionColumnNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135965
2011-07-25 20:57:57 +00:00
Chandler Carruth c7ca5218b6 Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.
llvm-svn: 135962
2011-07-25 20:52:32 +00:00
Chandler Carruth ca757587a3 Rename SourceManager::getImmediateInstantiationRange to
getImmediateExpansionRange.

llvm-svn: 135960
2011-07-25 20:52:21 +00:00
Axel Naumann ac50dcf6d3 Pick up expected diagnostics not only in the main file but also in the file where the first diagnostic occurred.
Useful if the main file is not relevant (like with cling).
By Vassil Vassilev.

llvm-svn: 135936
2011-07-25 19:18:12 +00:00
Chandler Carruth 6d28d7f2a3 Rename SourceManager::getInstantiationRange to getExpansionRange.
llvm-svn: 135915
2011-07-25 16:56:02 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

llvm-svn: 135914
2011-07-25 16:49:02 +00:00
Chris Lattner 54b1677d23 Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!
llvm-svn: 135855
2011-07-23 17:14:25 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Jonathan D. Turner 2214acd86e Remove prepending of '$' to module names.
llvm-svn: 135775
2011-07-22 17:25:03 +00:00
Douglas Gregor c567ba26e9 Switch all of the "isysroot" const char*'s throughout the AST reader
and writer to StringRef or std::string, as appropriate.

llvm-svn: 135769
2011-07-22 16:35:34 +00:00
Douglas Gregor a6895d8a8f Rename ASTReader::PerFileData to serialization::Module, pulling it out
of ASTReader so it can become its own full-fledged class
(eventually). No functionality change.

llvm-svn: 135767
2011-07-22 16:00:58 +00:00
Argyrios Kyrtzidis 55e7557481 For ASTUnit::Save, write the AST to a temporary and then rename it to the actual filename.
Should avoid race conditions. Addresses rdar://9788943.

llvm-svn: 135691
2011-07-21 18:44:49 +00:00
Argyrios Kyrtzidis ff9a5506c9 Cut down one open/close pair of system calls by using Path's makeUnique instead of createTemporaryFileOnDisk.
llvm-svn: 135690
2011-07-21 18:44:46 +00:00
Douglas Gregor 4a9c39a2f6 Rework the detailed preprocessing record to separate preprocessing
entities generated directly by the preprocessor from those loaded from
the external source (e.g., the ASTReader). By separating these two
sets of entities into different vectors, we allow both to grow
independently, and eliminate the need for preallocating all of the
loaded preprocessing entities. This is similar to the way the recent
SourceManager refactoring treats FileIDs and the source location
address space.

As part of this, switch over to building a continuous range map to
track preprocessing entities.

llvm-svn: 135646
2011-07-21 00:47:40 +00:00
Argyrios Kyrtzidis d571363e45 [arcmt] Add some additional driver flags to optionally emit or save the pre-migration ARC errors.
-arcmt-migrate-emit-errors : Emits the pre-migration ARC errors but it doesn't affect anything else
-arcmt-migrate-report-output : Writes out the pre-migration ARC errors to the provided plist file

rdar://9791454

llvm-svn: 135491
2011-07-19 17:20:03 +00:00
Douglas Gregor 925296b4c2 Revamp the SourceManager to separate the representation of parsed
source locations from source locations loaded from an AST/PCH file.

Previously, loading an AST/PCH file involved carefully pre-allocating
space at the beginning of the source manager for the source locations
and FileIDs that correspond to the prefix, and then appending the
source locations/FileIDs used for parsing the remaining translation
unit. This design forced us into loading PCH files early, as a prefix,
whic has become a rather significant limitation.

This patch splits the SourceManager space into two parts: for source
location "addresses", the lower values (growing upward) are used to
describe parsed code, while upper values (growing downward) are used
for source locations loaded from AST/PCH files. Similarly, positive
FileIDs are used to describe parsed code while negative FileIDs are
used to file/macro locations loaded from AST/PCH files. As a result,
we can load PCH/AST files even during parsing, making various
improvemnts in the future possible, e.g., teaching #include <foo.h> to
look for and load <foo.h.gch> if it happens to be already available.

This patch was originally written by Sebastian Redl, then brought
forward to the modern age by Jonathan Turner, and finally
polished/finished by me to be committed.

llvm-svn: 135484
2011-07-19 16:10:42 +00:00
Alexis Hunt 8cb46bb51c Implement a __WCHAR_UNSIGNED__ macro and use it to include WCHAR_MIN and
WCHAR_MAX in limits.h, thus solving the problem where the system header
thinks it knows better.

llvm-svn: 135455
2011-07-19 00:50:57 +00:00
Frits van Bommel 717d7edd3e Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.

llvm-svn: 135390
2011-07-18 12:00:32 +00:00
Francois Pichet 8e122b9fca Do not modify string returned by getenv on Windows.
Fixes PR9875, patch by Nikola Smiljanic!

llvm-svn: 135356
2011-07-16 21:17:14 +00:00
Chandler Carruth 46a32c2f0a Update the remaining comments in Frontend to 'expansion'.
llvm-svn: 135150
2011-07-14 16:14:52 +00:00
Chandler Carruth de81fc8557 NestedMacroInstantiations -> NestedMacroExpansions
This is switches all the interfaces points (and most of the commenst
/ local variables I saw on my way through) regarding the
NestedMacroInstantiations bit.

The libclang enums corresponding to this state were renamed, but
a legacy enum was added with the old name, and the same value to keep
existing clients working. I've added a documentation blurb for it, but
let me know if there is a canonical way to document legacy elemenst of
the libclang interface.

No functionality changed here, even in tests.

llvm-svn: 135141
2011-07-14 09:02:10 +00:00
Chandler Carruth 64d376a8fa Switch all local code and comments from '[Ii]nstantiat(ion|ed)' to
'[Ee]xpan(sion|ded)' in the TextDiagnosticPrinter.

No functionality changed.

llvm-svn: 135136
2011-07-14 08:20:31 +00:00
Chandler Carruth cd7a02ec1b Switch the diagnostic messages about macros to use the terms 'expanded'
and 'expansions' rather than 'instantiated' and 'contexts'.

This is the first of several patches migrating Clang's terminology
surrounding macros from 'instantiation' to 'expansion'.

llvm-svn: 135135
2011-07-14 08:20:28 +00:00
John McCall 3f4138c5d0 In debugger mode, make ObjC message sends to unknown selectors return
__unknown_anytype, and rewrite such message sends correctly.

I had to bite the bullet and actually add a debugger support mode for this
one, which is a bit unfortunate, but there really isn't anything else
I could imagine doing;  this is clearly just debugger-specific behavior.

llvm-svn: 135051
2011-07-13 17:56:40 +00:00