Граф коммитов

1198 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 33e9abd210 Teach CIndex's cursor visitor to restrict its traversal to a specific
region of interest (if provided). Implement clang_getCursor() in terms
of this traversal rather than using the Index library; the unified
cursor visitor is more complete, and will be The Way Forward.

Minor other tweaks needed to make this work:
  - Extend Preprocessor::getLocForEndOfToken() to accept an offset
  from the end, making it easy to move to the last character in the
  token (rather than just past the end of the token).
  - In Lexer::MeasureTokenLength(), the length of whitespace is zero.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 19:49:59 +00:00
Douglas Gregor f5bab418ae Visit if, switch statements properly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94126 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 01:00:11 +00:00
Douglas Gregor 1ef2fc1888 Teach the cursor visitor to walk all of the C and Objective-C
declarations that have enough source information to make such a walk
useful. This includes walking into variable initializers and enum
constants, the types behind typedefs, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 00:50:27 +00:00
Douglas Gregor a59e390ed6 Teach the cursor visitor to walk statements and expressions, including
a few important subkinds. Now we're cookin' with gas!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 23:27:09 +00:00
Douglas Gregor 2332c117b1 Teach the cursor visitor to walk into typeof types (both kinds). This
is hard to test now; tests will come when we can walk stataements and
expressions properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 20:48:56 +00:00
Douglas Gregor f20dfbcdaa Teach the cursor visitor to walk into a variety of different TypeLoc
kinds, so that we see referenced types, protocols, classes, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 17:29:07 +00:00
Douglas Gregor 7d0d40e588 Introduce type references into the C API, capturing references to
typedefs only (for now).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-21 16:28:34 +00:00
Douglas Gregor b2cd487561 Stash a CXXUnit pointer into each cursor. This allows us to simplify
the interface to clang_visitChildren() by eliminating the
CXTranslationUnit pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 23:57:43 +00:00
Douglas Gregor 5bfb8c128c Eliminate the MakeCXCursor routines that require their callers to know too much about the cursor's storage
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94049 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 23:34:41 +00:00
Douglas Gregor 04d1dd476a Kill CXEntity and CXDecl. The first has never been used, while the
second has been wholly replaced by cursors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 22:14:22 +00:00
Douglas Gregor 78205d4bad Kill some CXDecl-related APIs that have been superceded by
CXCursor-based APIs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:45:58 +00:00
Douglas Gregor 002a528ab0 Kill clang_loadDeclaration() and clang_loadTranslationUnit().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:37:00 +00:00
Douglas Gregor e5b72bac83 Switch c-index-test from clang_loadDeclaration() and
clang_loadTranslationUnit() over to clang_visitChildren().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:32:04 +00:00
Douglas Gregor 7b691f3382 Switch the internals of clang_loadTranslationUnit() over to the new
cursor-based traversal, and eliminate TUVisitor. We're now down to one
visitor for traversing the AST. Yay!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 21:13:59 +00:00
Douglas Gregor b1373d03e4 Introduce a new, cursor-based traversal function that visits the
children of a given cursor, regardless of what kind of cursor it
is. This is a generalization of clang_loadDeclaration and
clang_loadTranslationUnit that will also extent to statements,
expressions, etc.

As proof-of-concept, switched clang_loadDeclaration() from its own
visitor over to an instance of this traversal function internally.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94022 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 20:59:29 +00:00
Douglas Gregor 09cd6ef46e Remove some #if 0'd code that's never going to get used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:34:08 +00:00
Douglas Gregor e0356b1083 Kill off clang_getDeclColumn, clang_getDeclExtent, clang_getDeclLine,
clang_getDeclSource, and clang_getDeclSourceFile; the cursor
equivalents are the way of the future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:26:57 +00:00
Douglas Gregor 7eaa8ae869 Introduce a special cursor kind for the translation unit, to serve as
the root of the conceptual cursor hierarchy (just like we do with
declarations). This will be used when we get to unify
clang_loadTranslationUnit() and clang_loadDeclaration() into something
more generally useful.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93954 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 00:23:15 +00:00
Douglas Gregor e0ca4baa1d Kill CXCursor_ObjCSelectorRef, CXCursor_VarRef, CXCursor_FunctionRef,
and CXCursor_EnumConstantRef; they've been subsumed by expression
references, which do a much nicer job.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 23:25:01 +00:00
Douglas Gregor 97b9872d57 Extend the CIndex API with direct support for expressions and
statements, moving some of the more unnatural kinds of references
(VarRef, EnumConstantRef, etc.) over to the expressions. We can now
poke at arbitrary expressions and statements with, e.g.,
clang_getCursor() and get back useful information (e.g., source
ranges).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 23:20:36 +00:00
Douglas Gregor e8c7043f6c Kill the unused and unnecessary CXCursor_MemberRef, twin to the
now-dead CXCursor_ObjCIvarRef.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93928 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:15:34 +00:00
Douglas Gregor 5a5ec3a318 Kill CXCursor_ObjCIvarRef. Such cursors could never be created, and
have been marked for death for a while.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:11:32 +00:00
Douglas Gregor 301221313b Introduce the notion of an "unexposed" declaration into the CIndex
API. This is a catch-all for any declaration known to Clang but not
specifically part of the CIndex API. We'll use the same approach with
expressions, statements, references, etc., as needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:07:56 +00:00
Douglas Gregor 1db19dea8d Rework the CXSourceLocation and CXSourceRange APIs. They are now
opaque data structures accessed through the new functions
clang_getInstantiationLocation(), clang_getRangeStart(), and
clang_getRangeEnd(). The new API permits later extensions to introduce
new functions to allow CIndex clients to walk macro instantiations, if
we ever care.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 21:36:55 +00:00
Douglas Gregor b699866820 Eliminate cursor kinds used to express definitions. Instead, provide
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.

This is another API + ABI breaker with no deprecation. Yay, progress.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 19:34:47 +00:00
Douglas Gregor c5d1e9375d Introduce clang_getCursorReferenced, to get a cursor pointing at the
entity that a particular cursor references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 01:20:04 +00:00
Douglas Gregor a7bde20f8c Implement clang_getCursorExtent, which provides a source range for the
cursor itself. In particular, for references this returns the source
range of the reference rather than the source range of the thing it
refers to.

Switch c-index-test from clang_getDeclExtent (which will eventually be
deprecated and removed) over to clang_getCursorExtent. The source
ranges we print for references now make sense; fix up the tests
appropriately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 00:34:46 +00:00
Douglas Gregor f46034af49 Teach clang_getCursorLocation() to return the locations of references
rather than the locations that refer to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 23:41:10 +00:00
Ted Kremenek e381c997e2 Tweak USR output for ObjC categories.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 23:25:32 +00:00
Douglas Gregor 547836fad9 Now that a reasonable deprecation cycle has passed, kill
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile() outright.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:48:04 +00:00
Douglas Gregor 98258afae6 Introduce clang_getCursorLocation(), which supercedes
clang_getCursorLine(), clang_getCursorColumn(),
clang_getCursorSource(), and clang_getCursorSourceFile(). Mark those 4
functions as deprecated and stop using them ourselves.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:46:11 +00:00
Ted Kremenek b82b3beda0 Refactor USR generation for TagDecls into a common method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93799 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:42:20 +00:00
Douglas Gregor 3c7313d96c Clean up the CIndex API slightly.
Renamed CXSourceFileLine to CXSourceLocation and added a CXFile, to
better match Clang's SourceLocation. Teach clang_getDeclExtent to fill
in the CXFile properly.

Renamed CXSourceExtent to CXSourceRange, to better match Clang's
SourceLocation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:13:09 +00:00
Ted Kremenek 6483a773db Explicitly not handle ObjCForwardProtocolDecl in GetCursorKind().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93779 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:07:45 +00:00
Ted Kremenek 3adca6d3f3 Tweak USR generation to handle anonymous bitfields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93778 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 22:02:49 +00:00
Ted Kremenek cf84aa46de Replace clang_getDeclUSR() with clang_getCursorUSR(). Also remove printing 'contexts' from c-index-test output; it wasn't helpful and was extremely brittle.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 20:23:29 +00:00
Douglas Gregor e83b4c17b1 Make CMake's clang++ installation respect DESTDIR, based on a patch by
Ingmar Vanhassel. Fixes PR6046.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93741 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 18:27:29 +00:00
Daniel Dunbar 3f693d25d4 Don't build/install clang++ in CLANG_IS_PRODUCTION build mode yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 17:52:48 +00:00
Daniel Dunbar c81d718f60 Fix -Asserts warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 17:52:42 +00:00
Douglas Gregor 1adb082a70 Give ObjCClassRef cursors a sane representation, which is encapsulated
in CXCursor.cpp. With this sane representation, fix the class
reference that is part of Objective-C category declarations so that
the cursor's location matches up with the reference, not the class
being referred to.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93640 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 17:14:40 +00:00
Douglas Gregor 78db0cdd49 Use a sane encoding for CXCursor_ObjCProtocolRef, using the actual
source locations where the protocols were referenced rather than the
location of some random enclosing declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 15:44:18 +00:00
Douglas Gregor 2e331b938b Give CXCursor_ObjCSuperClassRef a sane encoding, which is only known
to CXCursor.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 14:00:32 +00:00
Ted Kremenek 10fa3ccf08 Add mapping from ObjCPropertDecl to CXCursorKind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93623 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 02:08:29 +00:00
Ted Kremenek deb06bd356 Remove 'default' case in switch statement in clang_getCursorKindSpelling(). This identified a missing case (warned by the compiler) and identified that CXCursor_FirstDecl didn't actually correspond to the first decl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93622 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 02:02:09 +00:00
Ted Kremenek 70ee542580 Remove TranslateKind and centralize Decl -> CXCursorKind in GetCursorKind(). This revealed a bunch of inconsistencies in how CXCursorKinds were being computed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 01:44:12 +00:00
Ted Kremenek edc8aa68ef Migrate Decl* -> cursorkind logic into CXCursor.cpp, and drastically tighten TUVisitor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93599 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-16 00:36:30 +00:00
Ted Kremenek 38afa4156c Remove unused code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 23:35:12 +00:00
Ted Kremenek c5b48b3319 Refactor USR logic for EnumDecls and RecordDecls so that both handle 'anonymous' declarations in the same way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93585 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 23:34:31 +00:00
Ted Kremenek 6a659fb916 USR generation: look at the typedef of an anonymous struct (if any) when trying to generate a USR.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93572 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 23:08:25 +00:00
Douglas Gregor 283cae37b0 Make CXCursor's data opaque.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 21:56:13 +00:00
Ted Kremenek 16c440a377 Add CXCursor.[h,cpp]. These files will centralize the logic for creating/probing CXCursors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 20:35:54 +00:00
Ted Kremenek 5467b208d5 Add USR generation for enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 20:04:31 +00:00
Douglas Gregor f2c87bd036 Add -cursor-at=file:line:column command line option to c-index-test,
to directly check the results of clang_getCursor(). Also, start
migrating some index-test tests over to c-index test [*] and some
grep-using tests over to FileCheck.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93537 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 19:40:17 +00:00
Ted Kremenek 8b456e841e getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93520 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-15 18:24:18 +00:00
Ted Kremenek f462989fe8 Switch return site to use clang_getNullCursor().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 01:51:23 +00:00
Ted Kremenek 2fee4e6446 Further tweak USR generation by shorting names and distinguish between namespaces and functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93404 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 01:50:21 +00:00
Ted Kremenek fb48049fd5 Reorganize CIndex.cpp into clearer sections of functions, and add a utility function 'MakeCXCursor' to centralize the logic for creating CXCursor objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 21:46:36 +00:00
Ted Kremenek b89e8f64e6 Add 'referringDecl' field to CXCursor to prepare the way to better model declaration references from other delcarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 19:59:20 +00:00
Ted Kremenek bb239b231b Add extra null check in clang_disposeString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93328 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 18:45:36 +00:00
Daniel Dunbar 0397af277e cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
clang -cc1 logic for running an action against a set of options.
 - This should make it easier to build tools that have a clang -cc1 like
   interface, but aren't actually part of clang -cc1.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:48:06 +00:00
Daniel Dunbar a817b77bbb cc1: Lift creation of the FrontendAction higher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93281 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:47:51 +00:00
Ted Kremenek dd6bcc5f79 Move definitions for visitor methods in CDeclVisitor out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93276 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:22:49 +00:00
Ted Kremenek f128618615 Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 00:13:47 +00:00
Ted Kremenek 7d40562f83 Add USR printing modes to c-index-test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93269 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 23:34:26 +00:00
Ted Kremenek 4a884fda19 Make clang_getDeclUSR() visible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 23:34:05 +00:00
Ted Kremenek c50277f748 Rename clang_getUSR() -> clang_getDeclUSR(). For now we take a CXDecl instead of a CXEntity.
Enhance USR generation a bit with support for records.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 23:33:42 +00:00
Ted Kremenek e9cde116a9 Further tweaking of USR generation. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 19:35:53 +00:00
Ted Kremenek 98271567b6 Make 'CXTranslationUnitIterator' an argument to perform_test_load(),
perform_test_load_tu(), and perform_test_load_source().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 18:53:15 +00:00
Benjamin Kramer 9895c6ab2a Remove trailing semicolons and silence MSVC warning about C linkage.
warning C4190: 'GetEntity' has C-linkage specified, but returns UDT
'clang::idx::Entity' which is incompatible with C


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 11:32:40 +00:00
Daniel Dunbar 140fce2e7f Remove duplicate class name, MSVC doesn't like this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 02:34:07 +00:00
Ted Kremenek 8776382f7e Add a boilerplate implementation for clang_getUSR(). WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 02:07:58 +00:00
Ted Kremenek 1fc00e6e49 Change clang_getUSR() to return a CXString instead of a 'const char *'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:38:53 +00:00
Ted Kremenek 4b333d2215 Make createCXString() a static member function of class CIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 00:36:38 +00:00
Ted Kremenek 3172383341 CIndex:
- Remove unused (and unimplemented) clang_getDeclarationName().
- Remove unused (and unimplemented) clang_getEntity().
- Add clang_getEntityFromDecl(): maps from a CXDecl to a CXEntity)
- Add clang_getDeclaration(): maps from a (CXEntity, CXTranslationUnit) to a CXDecl).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-11 23:56:39 +00:00
Douglas Gregor 01dfea02d1 Improve code completion by introducing patterns for the various C and
C++ grammatical constructs that show up in top-level (namespace-level)
declarations, member declarations, template declarations, statements,
expressions, conditions, etc. For example, we now provide a pattern
for

  static_cast<type>(expr)

when we can have an expression, or

  using namespace identifier;

when we can have a using directive.

Also, improves the results of code completion at the beginning of a
top-level declaration. Previously, we would see value names (function
names, global variables, etc.); now we see types, namespace names,
etc., but no values.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 23:08:15 +00:00
Ted Kremenek 6ab9db10c5 For now, add back clang_getDeclSource().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 17:11:32 +00:00
Ted Kremenek 254ba7cd3b More crashtracer enhancements to CIndex. When "popping" a crashtracer string
restore to the one most recently created.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92959 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 23:13:53 +00:00
Ted Kremenek 29b7284c98 Tidy up crashtracer logic in CIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 22:49:05 +00:00
Ted Kremenek 9096a20fc0 Add FileCheck prefix to another location in the output of c-index-test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 01:17:12 +00:00
Ted Kremenek d8210650ed Change clang_getDeclExtent() to have the endpoint point to the last character in the last token.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92869 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 23:43:31 +00:00
Daniel Dunbar 378d4baf37 Add _clang_getDeclExtent to export list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92825 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 05:41:00 +00:00
Ted Kremenek 8a8da7d17d Add enhanced crash reporter breadcrumbs for clang_createTranslationUnitFromSourceFile().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 03:42:32 +00:00
Ted Kremenek 377adb6cff Remove unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92804 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 23:22:20 +00:00
Ted Kremenek 817db7cb9b Remove deprecated function 'clang_getDeclSource()'. Use 'clang_getDeclFile()' instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92803 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 23:21:30 +00:00
Ted Kremenek fe6fd3d41a Add C API hook 'clang_getDeclExtent()', which returns the source extent of a declaration. This implements <rdar://problem/7280072>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 23:18:49 +00:00
Ted Kremenek 1b6869a183 Split (mostly nonexistent) USR code out from the main CIndex logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 22:06:45 +00:00
Ted Kremenek db3d0da170 Add back #include of 'cstdio' to hopefully unbreak the build on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92765 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 20:55:39 +00:00
Ted Kremenek ab1889321f Split code in CIndex.cpp into multiple source files, and remove some unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 19:32:54 +00:00
Douglas Gregor 1733c35f44 Turn on code-completion for macros within CIndex
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-04 19:45:17 +00:00
Daniel Dunbar 0dea4be511 Driver: Use "g++" as generic gcc name when running in C++ mode, for platforms
that lack real tool definitions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-25 20:21:23 +00:00
Kovarththanan Rajaratnam 49ac8e63a0 Remove RewriteBlocks. It has been superseded by RewriteObjC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 18:03:34 +00:00
Ted Kremenek 20b4a58e52 Add c++-analyzer symlink (which is used by scan-build)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-22 23:00:32 +00:00
Douglas Gregor ff5ce6eefc Extend code-completion results with the type of each result
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 18:53:37 +00:00
Douglas Gregor ec6762c709 Change clang_codeComplete API to return the results in a structure on
the heap, so that clients are not forced to copy the results during
the initial iteration. A separate clang_disposeCodeCompleteResults
function frees the returned results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 16:20:58 +00:00
Chandler Carruth 4da689a025 Test for errors during fread() inside c-index-test and handle them
appropriately. This also silences some pedantic GCC warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 09:18:43 +00:00
Ted Kremenek 79433b5991 Compute the right extension for preprocessed Objective-C++ files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91547 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 18:32:41 +00:00
Daniel Dunbar 3055be7e5a Fix pretty stack traces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 11:47:38 +00:00
Ted Kremenek 51b939fe14 Add logic for computing preprocessor file extensions for C++ files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 05:02:47 +00:00
Ted Kremenek 51365b5f74 scan-build/ccc-analyzer: start analyzing C++ FTW.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 02:35:54 +00:00
Daniel Dunbar 8b9adfea5e Add -resource-dir to clang -cc1, this allows the base directory for compiler
resources (e.g., /usr/lib/clang/1.1) to be passed on the command line instead of
computed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 00:06:45 +00:00
Daniel Dunbar 869824e879 Lift builtin-include-path logic out of ASTUnit::LoadFromCommandLine and fix CIndex to pass in the right directory (previously it was using the path to the main executable, which generally is wrong).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91238 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 03:46:13 +00:00
Daniel Dunbar 1e69fe3a9f CompilerInvocation: Move builtin-include-path logic out of CompilerInvocation::CreateFromArgs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91237 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-13 03:45:58 +00:00
Jeffrey Yasskin 9f61aa9e28 Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gave
no extra safety anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 05:05:38 +00:00
Daniel Dunbar 864db01dec Remove clang-cc tool, it has joined in unholy union with clang.
- tools/driver will be renamed to tools/clang at some point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91195 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-12 00:56:47 +00:00
Ted Kremenek 6fba85dc65 scan-build: when the build command is 'make', override the CC and CXX options by passing them as arguments to make. This fixes <rdar://problem/6790224>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 23:22:52 +00:00
Ted Kremenek 32317b214f Remove more old references to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 23:12:52 +00:00
Ted Kremenek 2a3a8b9f47 Convert scan-build and ccc-analyzer over to using 'clang -cc1' instead of using 'clang-cc'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 22:44:53 +00:00
Daniel Dunbar 2108577809 Implement clang -cc1.
- I apologize for the link time horrors, my goal is to kill off clang-cc in fairly short order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91170 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 22:20:12 +00:00
Douglas Gregor 90742c1318 clang_getCompletionChunkText() will treat optional strings as empty text blocks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91072 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 22:46:19 +00:00
Jeffrey Yasskin e3fdca2ee0 Remove several .c_str() to be forward-compatible with StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 01:46:24 +00:00
Ted Kremenek b40d06dec2 Enable '-analyzer-opt-analyze-nested-blocks' by default for testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90812 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 22:26:14 +00:00
Daniel Dunbar bb3503a146 Document that CompilerInvocation::createDiagnostics keeps a reference to the DiagnosticOptions, and update callers to make sure they don't pass in a temporary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-06 09:56:30 +00:00
Steve Naroff 0304c6cb7f Remove 'LangOpts' from Diagnostic (added in http://llvm.org/viewvc/llvm-project?view=rev&revision=90642).
Simply use the 'LangOpts' member already present in TextDiagnosticPrinter.

Sorry for the confusion!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90664 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 12:23:07 +00:00
Daniel Dunbar 942209729a CIndex: For the time being, don't return translation units if we encounter an error during parsing.
- We need to be more careful in the rest of CIndex if we are to handle
   possibly-invalid ASTs, and don't have much experience with this yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 02:17:18 +00:00
Steve Naroff e0c4d895ff Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71086

Note - This commit only includes the fix for:

<rdar://problem/6309338> slightly different error message format for Visual Studio.

The fix for <rdar://problem/6845623> from protocol to template. is separate/forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 02:14:08 +00:00
Rafael Espindola 0f4c59c3be Add gcc's -no-canonical-prefixes option to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 19:31:58 +00:00
Daniel Dunbar f772d1e2a5 ASTUnit/CIndex: Explicitly track the top-level decls when using an ASTUnit made
from a source file.
 - This allows CIndex to avoid iterating over all the top-level decls when using
   a PCH, which means we deserialize far fewer decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 08:17:33 +00:00
Daniel Dunbar 36841b3636 Kill off one last exit() call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90439 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 09:13:43 +00:00
Daniel Dunbar 5e96f9d983 clang-cc: Move to CompilerInvocation based command line parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 07:23:38 +00:00
Daniel Dunbar 9b5e9ae08d clang-cc: Honor -help and -version when using new style option parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 07:01:58 +00:00
Daniel Dunbar 7bd716557b Update test and CIndex to use -FOO BAR form for -{remap-file,code-completion-at}.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 05:32:40 +00:00
Daniel Dunbar efba227cc5 Add clang -cc1 -load option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 05:11:05 +00:00
Daniel Dunbar 8506dde586 Switch clang_createTranslationUnitFromSourceFile to use ASTUnit::LoadFromCommandLine.
- This is much faster, as it avoids the overhead of dumping an AST file to disk and reloading it.
 - For debugging purposes, there is a clang_setUseExternalASTGeneration hook which can be used to disable this.

On the Sketch Cocoa app, the speedup is pretty nice, especially when using a PCH file while scanning the source:

Wall time to c-index-test all files (no PCH):
Old: 23.4221
New: 12.3884

Wall time to c-index-test all files (with a PCH, and "local" mode):
Old: 10.9233
New:  1.9038

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 01:54:28 +00:00
Daniel Dunbar 5262fda30b Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; propogate and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 01:45:44 +00:00
Daniel Dunbar 467f030960 Normalize CIndex/c-index-test/index-test link lines in the hopes it will fix
*something*.
 - We really need to fix how LLVM's build systems manage
   linking. Pretty-please-someone-else-do-this? :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 21:47:55 +00:00
Nuno Lopes 7896ea1288 this also depends on libDriver. this almost fixes the build problems of c-index-test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 20:20:47 +00:00
Mike Stump de05057932 Change rtti/Rtti to RTTI, as it is an acronym.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90334 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 18:57:08 +00:00
Douglas Gregor 735df88a38 Extend the CIndex code-completion API to perform code completion
involving unsaved files, using the -remap-file= functionality recently
added to clang-cc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 09:21:34 +00:00
Daniel Dunbar d378181dd2 Fix relative ordering of Analyis library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90312 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 08:44:24 +00:00
Douglas Gregor 716f0b3e2e Introduce a new clang-cc option
-remap-file=from;to

which takes the file "from" and transparently replaces its contents
with the contents of the file "to" from the source manager's
perspective. This is the moral equivalent of

  cp from saved
  cp to from
  <call clang>
  cp saved from
  rm saved

without all of the pesky file copying.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 08:08:39 +00:00
Zhongxing Xu 7dea1f916e libFrontend depends on libDriver now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 05:45:19 +00:00
Daniel Dunbar 7b55668db7 Add ASTUnit::LoadFromCommandLine, which creates an ASTUnit out of a list of
(clang/driver) command line arguments (including the source file).
 - The arguments are expected to include the source file.

 - The idea is that even though this is a somewhat odd API, its the form which
   many tools can most easily use (for example, by interposing with the compiler).

Also, switch index-test's -ast-from-source to use this entry point, and provide
a -arg command line argument which can be used to test that the command line
arguments are handled correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-02 03:23:45 +00:00
Nuno Lopes 360f075fc6 fix build on linux
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 12:49:04 +00:00
Daniel Dunbar 521bf9c529 Add ASTUnit::LoadFromCompilerInvocation, which does what it says.
Also, add an -ast-from-source option to index-test which allows index-test to
run on source files directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 09:51:01 +00:00
Kovarththanan Rajaratnam d8fdde1196 Tuck away scan-build related files into tools/scan-build
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90215 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 06:52:01 +00:00
Douglas Gregor 2b4074f1d3 Switch the clang-to-CIndex interface for code-completion to a binary format, for a massive speedup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 05:55:20 +00:00
Daniel Dunbar 9ebfa31222 CIndex: Normalize formatting some more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 03:14:51 +00:00
Daniel Dunbar 625e4efc2c c-index-test: Split "function scanning" behavior into its own "filter" -- its
quite slow and doesn't really stress the APIs people should really use.
 - I'm not even sure if this mode is still useful given the other scanning mode;
   Steve?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 02:35:37 +00:00
Daniel Dunbar ada487d498 Add c-index-test -test-load-source, which loads the translation unit from a source file (and other command line arguments).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-01 02:03:10 +00:00
Daniel Dunbar acca725aef Reindent buffer, switches in particular were totally out of style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 20:42:49 +00:00
Daniel Dunbar 0d7dd22238 Strip trailing space.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 20:42:43 +00:00
Daniel Dunbar 9deb313835 clang-cc: Add code (currently disabled) for parsing arguments using clang -cc1 functionality instead of LLVM's CommandLine.
- It works and passes test suite, but I want to polish and test a wee bit more before making the switch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90128 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 08:42:10 +00:00
Daniel Dunbar 3b315264d1 Add CodeGenOptions::{SoftFloat,FloatABI}, and update the all the (far too many) places to use this instead of using the backend -soft-float and -float-abi= options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90127 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 08:42:00 +00:00
Daniel Dunbar 1bc5c03a7f Don't try to generate common globals for C++ files, instead of depending on the FE to set NoCommon, and simplify CodeGenOptions initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 08:40:34 +00:00
Daniel Dunbar b33fbaa5f1 Eliminate CodeGenOptions::TimePasses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 08:39:52 +00:00
Daniel Dunbar 3636e1d784 Eliminate CodeGenOptions::SimplifyLibCalls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 08:39:32 +00:00
Daniel Dunbar ae8e17e85a Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 07:18:20 +00:00
Daniel Dunbar c88aa79a6b Put CompilerInvocation testing code in clang-cc instead of clang for now, I can't bear to link all of clang into 'clang' yet. :)
- Still triggered by a magic leading -cc1 argument, as before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 07:18:13 +00:00
Daniel Dunbar e03245246a Change CompilerInvocation::CreateFromArgs to report errors using a proper diagnostic engine.
- Clients that care about having the diagnostics output honor the user-controllable diagnostic options can buffer the diagnostics and issue them later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90092 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 20:58:50 +00:00
Daniel Dunbar 545c28117c Change CompilerInvocation::CreateFromArgs to take Argv0 and the address of main (or something in the main executable) so it can find the builtin compiler files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 20:58:32 +00:00
Kovarththanan Rajaratnam f79bafa608 This patch moves the frontend timer from clang-cc into CompilerInstance.
CompilerInstance already contains various objects that are used
throughout the entire run.

Also addresses Daniels review comments in:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20091123/024508.html



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 09:57:35 +00:00
Daniel Dunbar f219e7c152 Move LLVM backend options to explicit clang-cc / clang -cc1 options, which we then manually pass to the command line library; eventually the latter grossness should be fixed by a real API when creating the target machine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 07:18:39 +00:00
Daniel Dunbar e50c16773b Add clang -cc1 parsing for LangOptions.
- This is the last major parsing piece, main FIXMEs remain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 05:52:21 +00:00
Daniel Dunbar 87e2496887 clang-cc: Tweak LangOptions parsing to make it a bit more obvious what depends on what.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 03:18:48 +00:00
Daniel Dunbar 7674352cf3 clang-cc: Change -fsigned-char=0 to -fno-unsigned-char and pass -pic-level using separate args.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90054 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 02:39:08 +00:00
Daniel Dunbar 7d065d0f21 Move MainFileName option variable into CodeGenOptions instead of LangOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-29 02:38:34 +00:00
Kovarththanan Rajaratnam d06ab9d442 Move program actions implications to clang::InitializeFrontendOptions which already contains such logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28 07:52:34 +00:00
Daniel Dunbar b8bef26c8d Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-27 08:26:00 +00:00
Daniel Dunbar f51ac1b3d0 Factor out a LangStandard class and coalesce the information about the standards into LangStandards.def
- I'd appreciate another pair of eyeballs to double check this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26 02:14:31 +00:00
Daniel Dunbar 1a50628f06 Add a missing include <cstdio>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 10:53:00 +00:00
Kovarththanan Rajaratnam aa7dd818c2 Sort CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89771 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 16:32:20 +00:00
Daniel Dunbar 33a33d8abd Sketch the rest of the clang -cc1 option definitions, aka fun with C-x C-(.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 00:54:16 +00:00
Daniel Dunbar e2814d8902 Add clang -cc1 parsing of analyzer options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 22:08:20 +00:00
Daniel Dunbar 20be8c4551 Switch CompilerInvocation::CreateFromArgs to take const char** arguments until Driver itself switches to StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89503 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 22:47:55 +00:00
Daniel Dunbar a31100e62f Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89498 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 22:21:52 +00:00
Daniel Dunbar 33b26ea313 clang-cc: Lift setForcedLangOptions out of options initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 16:55:31 +00:00
Benjamin Kramer d5dc9f34ef Add a workaround to silence a bogus g++-4.4 -pedantic warning.
driver.cpp:211: warning: ISO C++ forbids zero-size array 'argv'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 11:49:06 +00:00
Daniel Dunbar 1be3b3bd5c Fix some default in the option classes, and some CompilerInvocation argification
errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89388 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 20:54:59 +00:00
Douglas Gregor 6cef99d3e3 Try yet again to de-bork CMake Windows build w.r.t. clang++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 16:42:34 +00:00
Douglas Gregor 234e16229b Try to fix CMake clang++ creation on Windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 07:59:29 +00:00
Daniel Dunbar 217acbfa35 Sketch some 'clang -cc1' support, for testing parts of CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 07:37:51 +00:00
Douglas Gregor c720a4d6a6 CMake goop to create clang++ symlink
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 05:46:45 +00:00
Daniel Dunbar c59dc92746 clang-cc: Remove some more llvm:🆑:init arguments, by only setting values when
the argument is given.

Also, tweak Opt.Sysroot defaulting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 05:32:21 +00:00
Daniel Dunbar 4db166b723 Change -code-completion-debug-printer to -no-code-completion-debug-printer.
Also, tweak a few help strings and update CompilerInvocation serialization for prev change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 05:32:09 +00:00
Daniel Dunbar 53e8484581 Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm:🆑:init(true) arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89315 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 04:55:23 +00:00
Daniel Dunbar 48c4c1f9d3 clang-cc: Remove superfluous llvm:🆑:init(false) arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 04:55:06 +00:00
Daniel Dunbar 265e9ef9f3 Driver: ArgList doesn't depend on Options.h anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 04:25:22 +00:00
Daniel Dunbar f4961da8e3 Use TOOLALIAS so that clang++ gets 'built'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89286 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 00:21:33 +00:00
Ted Kremenek 1d5fdf3d3b Add special clang_getCursor() support for @class. Handles <rdar://problem/7383421>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 02:02:52 +00:00
Daniel Dunbar 67f401b4e9 Fix -Asserts warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 21:51:03 +00:00
Benjamin Kramer a9933b9839 fgetln is a BSDism; replace it with more portable code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 20:51:40 +00:00
Ted Kremenek 1c6da1735d Add c-index-test mode "-test-file-scan", which scans a source file and calls clang_getCursor() on every character.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 19:37:36 +00:00
Ted Kremenek 7388555543 Add clang_getNullCursor() and clang_equalCursors() (the latter for comparing cursors).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 19:28:59 +00:00
Ted Kremenek 4633d1b269 Allow "source_filename" to be an optional argument (the client can provide NULL). This allows the client to put the source_filename in the command_line_args without fear of the file being named twice.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 18:18:02 +00:00
Ted Kremenek 0d435191fc Organize c-index-test into logic sections, and add section headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 18:13:31 +00:00
Ted Kremenek f5d9c9340b Clean up c-index-test command line usage a bit by requiring a "-test-load-tu" option when testing clang_loadTranslationUnit(). Running c-index-test without the correct arguments now also prints a useful summary of its correct usage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 18:09:14 +00:00
Daniel Dunbar cd1b5cb91c Remove stale reference to old WPA dir, patch by Kovarththanan Rajaratnam.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 10:15:57 +00:00
Daniel Dunbar 2fc430d548 Eliminate TargetInfo::getDefaultLangOptions, this kind of logic is better done
in the driver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 09:15:44 +00:00
Daniel Dunbar c5a97ec194 Move -fnext-runtime defaulting to driver (and change clang-cc default to
-fnext-runtime), instead of using getDefaultLangOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 07:07:28 +00:00
Ted Kremenek ef7fdc6b73 Sort visitor methods. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 07:02:15 +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
Ted Kremenek 9298cfc747 Have clang_getCursorSource() return NULL when the source location is invalid or refers to a built-in buffer. Implements <rdar://problem/7296243>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:31:58 +00:00
Daniel Dunbar 223ebe399b Move InitializeAnalyzerOptions for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:05:08 +00:00
Daniel Dunbar 962b8b4e33 Remove unused NoPreprocess variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:04:57 +00:00
Daniel Dunbar 1b483e70ad Remove unused IsCXXAware and IgnoreSysRoots option from HeaderSearchOptions::Entry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-17 05:04:15 +00:00
Daniel Dunbar 9119e7e0a4 Trim includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 22:38:48 +00:00
Daniel Dunbar c363cb1929 Store more information in HeaderSearchOptions so that its initialization is not
language dependent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 22:38:40 +00:00
Daniel Dunbar 6143ea28a9 clang-cc: Eliminate cyclic dependency in initializing CodeGenOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-16 22:38:14 +00:00
Daniel Dunbar d58c03f42e Add TargetOptions and use it when constructing targets.
- This ended up being hard to factor, sorry for the large diff.

 - Some post-commit cleanup to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 06:48:46 +00:00
Daniel Dunbar 297b0833ad Add examples dir, built with BUILD_EXAMPLES=1 (Makefiles, no CMake equivalent yet).
Move tools/wpa to examples/wpa, and unbreak its build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 00:22:33 +00:00
Daniel Dunbar d10c5b8833 Add pluggable action support to clang-cc, via -plugin command line option.
- Expects the plugin has been loaded with -load.

 - Using this may require disabling TOOL_NO_EXPORTS in the clang-cc Makefile, this breaks the llvm::Registry way of working (static constructors are bad, kids). This should be replaced with a "real" plugin model that has explicit plugin interfaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-15 00:12:04 +00:00
Daniel Dunbar 9a8a83b8fe Move the program action enum to FrontendOptions.
--
ddunbar@giles:clang-cc (master)$ grep llvm:🆑:opt clang-cc.cpp  # Woot
ddunbar@giles:clang-cc (master)$
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 22:32:38 +00:00
Daniel Dunbar 4fdba99ccc clang-cc: Switch to using FrontendAction. Whee.
Please report any discrepancies you see in clang-cc, I'm not confident that our regression tests cover all the fun ways one can use clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 10:53:49 +00:00
Daniel Dunbar ccb6cb6fd9 Add CompilerInstance::InitializeSourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 07:53:04 +00:00
Daniel Dunbar 79b55f97c8 Turn -fixit it back into a mode, but make -fixit-at imply that mode this time
(instead of running it with arbitrary consumers).
 - Also, turn any -fixit-at lookup failure into an error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 04:39:29 +00:00
Daniel Dunbar f79dced038 Switch -verify implementation to use VerifyDiagnosticClient.
- Not tested, but -verify with multiple inputs should work now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 03:24:39 +00:00
Daniel Dunbar 7d90199f10 Pass Preprocessor through DiagnosticClient::BeginSourceFile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-14 02:48:04 +00:00
Ted Kremenek 8382cf57b7 Add clang-cc option "--analyzer-experimental-internal-checks". This
option enables new "internal" checks that will eventually be turned on
by default but still require broader testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 18:46:29 +00:00
Daniel Dunbar f482d59386 Add CompilerInstance utility functions for creating output files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 18:32:08 +00:00
Daniel Dunbar a920483163 Add output file list to CompilerInstance, so that it can track them instead of
forcing all clients to do it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 10:37:48 +00:00
Daniel Dunbar 84c639a1a8 clang-cc: Move output file initialization closer to use.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 10:18:59 +00:00
Daniel Dunbar 3d0dab330b Simplify, in anticipation of introducing explicit action instances.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 09:57:06 +00:00
Daniel Dunbar c2f484f1f0 Add CodeCompletion consumer to CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 09:36:05 +00:00
Daniel Dunbar 3a2838d142 Rework Sema code completion interface.
- Provide Sema in callbacks, instead of requiring it in constructor. This
   eliminates the need for a factory function. Clients now just pass the object
   to consume the results in directly.

 - CodeCompleteConsumer is cheap to construct, so building it whenever we are
   doing code completion is reasonable.

Doug, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 08:58:20 +00:00
Daniel Dunbar 0f800391ff Add CompilerInstance::createPCHExternalASTSource.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 08:21:10 +00:00
Daniel Dunbar 704e48ae75 Add CompilerInstance::has* methods for testing if the instance has a particular
subobject.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 08:20:57 +00:00
Daniel Dunbar 5eb810024d Add ASTContext to CompilerInstance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 08:20:47 +00:00
Daniel Dunbar 0fbb3d9a9c Add CompilerInstance::createDiagnostics, and move clang-cc to it.
clang-cc.cpp is now under 1k lines, if anyone is counting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 05:52:34 +00:00
Daniel Dunbar f819b25bbf Add a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 05:52:19 +00:00
Daniel Dunbar 22dacfacac Add Preprocessor to CompilerInstance, and move clang-cc CreatePreprocessor to
CompilerInstance::createPreprocessor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 05:52:11 +00:00
Daniel Dunbar 444be7366d Wherein the TargetInfo argument to Preprocessor is made 'const' and propogated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 05:51:54 +00:00
Daniel Dunbar 16b7449d86 Add {File,Source}Manager to CompilerInstance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 04:12:06 +00:00
Daniel Dunbar 2a79e162a3 Add CompilerInstance, and starting moving clang-cc to it.
- The design philosophy is in the CompilerInstance doxyment, if you don't agree
   with it now would be a good time to speak up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 03:51:44 +00:00
Daniel Dunbar fbe2fafe31 Move input kind identification (-x) into FrontendOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87066 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 02:06:12 +00:00
Ted Kremenek eb94113be0 Add clang-cc option "-analyzer-experimental-checks" to enable experimental path-sensitive checks. The idea is to separate "barely working" or "skunkworks" checks from ones that should always run. Later we need more fine-grain checker control.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87053 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:15:47 +00:00
Daniel Dunbar 21dac5e24a Move -target-{triple,abi} options into FrontendOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:02:19 +00:00
Daniel Dunbar 914474ca51 Move code completion options to clang-cc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-13 01:02:10 +00:00
Daniel Dunbar c86804bc9c Move FixItAtLocations into FrontendOptions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 23:52:56 +00:00
Daniel Dunbar 1417c74b82 clang-cc: Keep Verbose option with HeaderSearchOptions, for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 23:52:46 +00:00
Daniel Dunbar 26266885d6 Add FrontendOptions, and starting moving clang-cc to it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 23:52:32 +00:00
Chandler Carruth 2811ccf48d Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
This resolves the layering violation where CodeGen depended on Frontend.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 17:24:48 +00:00
Daniel Dunbar e0c4ff2fce Disallow FIX-ITs when generating code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 15:42:53 +00:00
Daniel Dunbar aa57614b89 clang-cc: Coalesce frontend options further.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86988 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 15:23:20 +00:00
Daniel Dunbar 6907943901 Move warning options into DiagnosticOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:28:44 +00:00
Daniel Dunbar 11e729d295 Move dump-build-information option into DiagnosticOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 07:28:21 +00:00
Daniel Dunbar 00e5b8d451 clang-cc: Factor CreateDiagnosticEngine out of main.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 06:48:31 +00:00
Daniel Dunbar bfbeadba36 clang-cc: -fixit is actually option, not an action, although its use with non
-fsyntax-only is probably untested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 06:48:24 +00:00
Daniel Dunbar 32358e24af Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 06:48:17 +00:00
Daniel Dunbar b3cb98ee35 Move TokenCache option to PreprocessorOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:59 +00:00
Daniel Dunbar 3574f46cf4 Switch PTHManager to using diagnostics for most errors.
Also, always give errors on a token-cache PTH failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:48 +00:00
Daniel Dunbar c67a5f9038 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:34 +00:00
Daniel Dunbar d1e7a964c6 clang-cc: Refactor ParseInputFollow to clearly split on the two primary cases,
when we are running an AST consumer and when we are just running the
preprocessor or parser alone.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:27 +00:00
Daniel Dunbar 975790e8f8 clang-cc: Factor ReadPCHFile out of ProcessInputFile.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:20 +00:00
Daniel Dunbar 6606864161 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:13 +00:00
Daniel Dunbar b4373b235d clang-cc: Unify InitializeSourceManager calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 02:53:06 +00:00
Daniel Dunbar 8e1bcb0ad3 clang-cc: Move non-Consumer action handling to common location, to expose the massive amount of redundancy we have introduced through blind copy-and-paste.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:36:27 +00:00
Daniel Dunbar 1ea52949b2 Fix PCH/preprocess test to be more useful, and unbreak -E mode with implicit
PCH, which I broke.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 01:36:20 +00:00
Daniel Dunbar c8daaa4513 Tweak formatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 00:24:28 +00:00
Daniel Dunbar 5746f1ff62 Move AnalyzerOptions into CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 00:24:10 +00:00
John Thompson 6a6742a8fc Fix clang executable path for Windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 23:11:14 +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 5814e657c9 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...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:21 +00:00
Daniel Dunbar ca11f61233 Sink AttachDependencyFileGen into CreatePreprocessor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:44:00 +00:00
Daniel Dunbar 0e0bae8139 Add DependencyOutputOptions to wrap -M... options, and propogate to
CompilerInvocation and clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 21:43:12 +00:00
Daniel Dunbar 387ecbd1e6 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:22:48 +00:00
Daniel Dunbar e26bd90e5f Fix unsafe use of StringRef I introduced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:10:25 +00:00
Daniel Dunbar 29cf746aef Add PreprocessorOutputOptions to CompilerInvocation, and move initialization to
clang-cc/Options.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:44 +00:00
Daniel Dunbar 775bee71ad Add PreprocessorOutputOptions, for things like -dM, -C, -CC which control -E
mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 10:07:22 +00:00
Daniel Dunbar 29a790ba42 Simplifiy target feature handling by coalescing all the logic into
InitializeCompileOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:56 +00:00
Daniel Dunbar dc8bbac2f8 Minor formatting tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:42 +00:00
Daniel Dunbar bd9f04b68b clang-cc: Refactor some -fixit-at handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:35 +00:00
Daniel Dunbar aea364195b Allow TextDiagnosticPrinter to have optional ownership of its output stream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 09:38:24 +00:00
Daniel Dunbar 339c13460e clang-cc: Move InitializeAnalyzerOptions into Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:55 +00:00
Daniel Dunbar d1cdcf38ca clang-cc: Start coalescing "frontend" options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:47 +00:00
Daniel Dunbar 0db4b765d7 clang-cc: Move InitializeDiagnosticOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:40 +00:00
Daniel Dunbar f797329454 clang-cc: Move HeaderSearchOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86818 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:32 +00:00
Daniel Dunbar dbf75feeb6 Turn LoggingDiagnosticClient into a more general ChainedDiagnosticClient and
move to libFrontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 08:13:24 +00:00
Daniel Dunbar 56749087b5 clang-cc: Move InitializeLangOptions to Options.cpp.
Also, inline InitializeLanguageStandard into InitializeLangOptions; this code
needs to be refactored but the current division doesn't make any sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 07:26:12 +00:00
Daniel Dunbar d9beeaf1f1 Inline some trivial functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 07:26:02 +00:00
Daniel Dunbar b52d243d36 clang-cc: Move InitializePreprocessorOptions to Options.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 06:10:03 +00:00
Daniel Dunbar d8daaa7450 clang-cc: Simplify this code, now that predefines handling is uniform in the
PCH/-E and PCH/not--E cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:33:31 +00:00
Daniel Dunbar 7b5a1210d9 Redo how PCH handles its implicit include. Instead of treating this specially in
the front-end (as far as the preprocessor goes), follow the usual logic of
inserting the (original include path) name into the predefines buffer. This
pushes the responsibility for handling this to PCH instead of the front-end.  In
PCH this requires being a little more clever when we diff the predefines
buffers.

Neither of these solutions are particularly great, I think what we eventually
should do is something like gcc where we insert a special marker to indicate the
PCH file, but then run the preprocessor as usual. This would be clearer and
would allow us to drop the overly clever predefines handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86806 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 05:29:04 +00:00
Daniel Dunbar 5ee0aa715d Recognize -fsyntax-only as a "consumer only" action.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:54:56 +00:00
Daniel Dunbar 0f9fed70ce Add Diagnostic::Report method for reporting diagnostics without a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 23:55:23 +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 e0a9581d60 Decouple more of clang-cc by moving ImplicitP[CT]H options into
PreprocessorOptions.

Global variables used as [in] [out] parameters considered harmful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 22:09:38 +00:00
Ted Kremenek 7976f5923c Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:38:41 +00:00
Dan Gohman 0063e98f59 Use #include <stdio.h> when using fprintf and stderr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86717 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 21:21:27 +00:00
Daniel Dunbar 0498cfc445 clang-cc: Start moving "pure" option handling to Options.cpp, to separate it
from the logic part of clang-cc, and to enforce limited scoping.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:53 +00:00
Daniel Dunbar 9773429c26 clang-cc: Sink more options inside codegenopts namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:46 +00:00
Daniel Dunbar e359445fd7 Change LangOpts initialization to directly test the code generation options,
instead of reproducing their logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:51:33 +00:00
Ted Kremenek 0854d70dab CIndex: Only display diagnostics to llvm::errs() when the client has set the 'displayDiagnostics' option to 1 in clang_createIndex(). This fixes <rdar://problem/7370691>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 19:18:52 +00:00
Daniel Dunbar 8fa01c8f98 Driver: Run 'clang' in C++ mode based on the name it was invoked by. We match
anything that ends with ++ or ++-FOO (e.g., c++, clang++, clang++-1.1) as being
a "C++ compiler".

This allows easy testing of the C++ compiler by 'ln -s clang clang++', or by 'cp
clang clang++'.

Based on patch by Roman Divacky.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 18:47:41 +00:00
Daniel Dunbar fcb0c3b39b Factor out parts of InitializeCompileOptions that depend on the LangOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 18:47:35 +00:00
Daniel Dunbar 8d35314401 Localize -disable-llvm-optzns handling to BackendConsumer::CreatePasses.
- This is conceptually better since the only thing we want this option to do is
   preserve the internal module as constructed by IRgen, before running any
   passes.

 - This also fixes bugs in -disable-llvm-optzns handling with regards to debug
   info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 17:50:53 +00:00
Daniel Dunbar bc2ea3406b clang-cc: Start sinking (CodeGen) options into namespaces to limit their scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 17:50:42 +00:00
Daniel Dunbar 9af869510b Cleanup some clang-cc FIXMEs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86686 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 16:23:44 +00:00
Daniel Dunbar 36f4ec353b Add CompileOptions to CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 16:19:45 +00:00
Daniel Dunbar 89f8c1d40e Simplify, following MemoryBuffer::getSTDIN API fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:25 +00:00
Daniel Dunbar 9253e49492 Remove some if-0'd code, we can resurrect this if we ever decide to support
continuing after invalid PCH loads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-10 00:46:12 +00:00
Daniel Dunbar 5fc7d344ae Add PreprocessorOptions to CompilerInvocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:12:31 +00:00
Daniel Dunbar 2cdafa8001 Privatize InitHeaderSearch, this functionality is only exposed via
ApplyHeaderSearchOptions now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86617 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 23:02:47 +00:00
Daniel Dunbar 26a0cac165 Move LangOptions, HeaderSearchOptions, and the target feature map into
CompilerInvocation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:17 +00:00
Daniel Dunbar 638c901ae3 Switch Target* to Target&.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:46:09 +00:00
Daniel Dunbar 227b2380f6 Change clang-cc to expect that all inputs have the same language (so we can only construct a single LangInfo). This matches how it is used in practice (since the compiler only it invokes it for one file at a time).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:45:57 +00:00
Daniel Dunbar 094a84cc06 (llvm up) Convert clang-cc.cpp:GetLanguage to StringSwitch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86608 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 22:45:47 +00:00
Douglas Gregor ff4393c1ce Make sure that we look into nested, transparent declaration contexts
when looking for a name within a given DeclContext. Now enumerators
will show up in code-completion results.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 21:35:27 +00:00
Daniel Dunbar e29709f32e Add CompilerInvocation object, to capture all the options one needs to invoke
the compiler, and start flood filling it into clang-cc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 20:55:08 +00:00
Benjamin Kramer 62cf322cf1 Factor CXString creation into a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 19:13:48 +00:00
Benjamin Kramer 858e5de143 Writing to a struct passed by value is pointless. Remove dead code.
- free(NULL) is a nop anyway.
- if someone thinks calling clang_disposeString twice should be legal
  please change the method to take a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-09 18:24:53 +00:00