Commit Graph

806 Commits

Author SHA1 Message Date
Steve Naroff e70a52a00c Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71086
http://llvm.org/viewvc/llvm-project?view=rev&revision=71107

Note: This fixes <rdar://problem/6845623> from protocol to template.
llvm-svn: 90665
2009-12-05 15:55:59 +00:00
Steve Naroff c275f70bf9 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!

llvm-svn: 90664
2009-12-05 12:23:07 +00:00
Steve Naroff 4fb3d9fcd7 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.

llvm-svn: 90642
2009-12-05 02:14:08 +00:00
John McCall b96ec56871 Fix "using typename" and the instantiation of non-dependent using declarations.
llvm-svn: 90614
2009-12-04 22:46:56 +00:00
Steve Naroff b0e3390f53 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=70978

llvm-svn: 90597
2009-12-04 21:36:32 +00:00
Steve Naroff f0df20a5ba Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=70926

llvm-svn: 90596
2009-12-04 21:29:41 +00:00
Steve Naroff 3ce3af2cb6 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=70922

llvm-svn: 90595
2009-12-04 21:18:19 +00:00
Daniel Dunbar 20c13165a0 PR5684: Fix refacto, the backend consumer was copying the Diagnostic object,
which meant that hasErrorOccurred() checks to prevent codegen-on-invalid weren't
working.

llvm-svn: 90560
2009-12-04 08:17:40 +00:00
Daniel Dunbar 644dca07b9 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.

llvm-svn: 90559
2009-12-04 08:17:33 +00:00
Chris Lattner 2474a7e9c2 Use PresumedLoc when emitting the 'included from' diagnostics. For a malformed
test like this:

#line 4 "foo"

#define XX ?

#if XX
#endif

We now emit:

In file included from t.c:7:
foo:7:5: error: invalid token at start of a preprocessor expression
#if XX
    ^
foo:5:12: note: instantiated from:
#define XX ?
           ^

instead of:

In file included from t.c:7:
foo:7:5: error: invalid token at start of a preprocessor expression
#if XX
    ^
./t.h:6:12: note: instantiated from:
#define XX ?
           ^

(where the note doesn't obey #line or print the include stack when needed).

This fixes PR5617

llvm-svn: 90554
2009-12-04 07:06:35 +00:00
Eli Friedman 3de20c55e9 Missed change from last commit.
llvm-svn: 90550
2009-12-04 06:46:54 +00:00
Ted Kremenek a3536e23c8 Try to make the output of PlistDiagnostics more deterministic by sorting PathDiagnostics before they are emitted. Fixes <rdar://problem/7439668>.
llvm-svn: 90478
2009-12-03 19:35:02 +00:00
Daniel Dunbar 6dac935b1f Fix two more diagnostic-on-stderr instances that thought they could hide from me -- they thought wrong.
llvm-svn: 90442
2009-12-03 09:14:12 +00:00
Daniel Dunbar f680e7d855 Kill a few more random stderr uses.
llvm-svn: 90441
2009-12-03 09:14:02 +00:00
Daniel Dunbar f5bda7b5eb Use llvm_report_error instead of fprintf + assert + exit.
llvm-svn: 90438
2009-12-03 09:13:36 +00:00
Daniel Dunbar 7554699afa Fix CompilerInstance::createOutputFile to use proper diagnostics, and (try to) update all clients to be able to handle failure.
llvm-svn: 90437
2009-12-03 09:13:30 +00:00
Daniel Dunbar 692bc47d25 Remove an unnecessary (I believe) exit() on error.
llvm-svn: 90436
2009-12-03 09:13:19 +00:00
Daniel Dunbar 3b95148ce1 Switch PCHReader::getOriginalSourceFile to use proper diagnostics.
llvm-svn: 90434
2009-12-03 09:13:06 +00:00
Daniel Dunbar acadc55d4e Fix BackendConsumer to use proper diagnostics.
llvm-svn: 90433
2009-12-03 09:12:54 +00:00
Daniel Dunbar 215ca5f199 clang-cc: Honor -help and -version when using new style option parsing.
llvm-svn: 90422
2009-12-03 07:01:58 +00:00
Daniel Dunbar 6048e7fdc0 Add clang -cc1 support for -remap-file.
llvm-svn: 90414
2009-12-03 05:11:16 +00:00
Daniel Dunbar da7a52289f Add clang -cc1 -load option.
llvm-svn: 90413
2009-12-03 05:11:05 +00:00
Daniel Dunbar 59203007ac Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; propogate and simplify.
llvm-svn: 90379
2009-12-03 01:45:44 +00:00
Daniel Dunbar a18f9580e4 ASTUnit: Explicitly track whether the ASTUnit came from an actual AST or not.
llvm-svn: 90349
2009-12-02 21:47:43 +00:00
Daniel Dunbar 4897349a79 ASTUnit: Fix initialization of OnlyLocalDecls variable, and honor UseBumpAllocator.
llvm-svn: 90348
2009-12-02 21:47:32 +00:00
Mike Stump c01c2b87e8 Change rtti/Rtti to RTTI, as it is an acronym.
llvm-svn: 90334
2009-12-02 18:57:08 +00:00
Douglas Gregor 407e2124bf Extend -remap-file=from;to to permit mapping from a non-existent
file. This is accomplished by introducing the notion of a "virtual"
file into the file manager, which provides a FileEntry* for a named
file whose size and modification time are known but which may not
exist on disk.

Added a cute little test that remaps both a .c file and a .h file it
includes to alternative files.

llvm-svn: 90329
2009-12-02 18:12:28 +00:00
Douglas Gregor 6ae34abd1b Move file-remapping logic into InitPreprocesor. No functionality change
llvm-svn: 90322
2009-12-02 16:32:41 +00:00
Daniel Dunbar a8a509376c Fix ASTUnit::getOriginalSourceFileName() when using ASTUnit's derived from
source files.

llvm-svn: 90311
2009-12-02 08:44:16 +00:00
Daniel Dunbar 7afbb8c08c ASTUnit: Don't create an LLVMContext, it shouldn't be needed.
llvm-svn: 90310
2009-12-02 08:43:56 +00:00
Douglas Gregor d062bff7ee 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.

llvm-svn: 90307
2009-12-02 08:08:39 +00:00
Douglas Gregor 53ad6b94b0 Extend the source manager with the ability to override the contents of
files with the contents of an arbitrary memory buffer. Use this new
functionality to drastically clean up the way in which we handle file
truncation for code-completion: all of the truncation/completion logic
is now encapsulated in the preprocessor where it belongs
(<rdar://problem/7434737>).

llvm-svn: 90300
2009-12-02 06:49:09 +00:00
Daniel Dunbar 55a17b66cd 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.

llvm-svn: 90288
2009-12-02 03:23:45 +00:00
Daniel Dunbar d2f8be3629 ASTUnit: Make sure to preserve the TargetInfo for later use.
llvm-svn: 90263
2009-12-01 21:57:33 +00:00
Rafael Espindola f8a04a1d6e Exit the command line into <built-in> instead of going directly from the command line to the input file.
We passed <built-in> on the way in, so we should pass it again on the way out.

llvm-svn: 90250
2009-12-01 18:28:16 +00:00
Daniel Dunbar 764c082027 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.

llvm-svn: 90223
2009-12-01 09:51:01 +00:00
Douglas Gregor f09935f16c Switch the clang-to-CIndex interface for code-completion to a binary format, for a massive speedup
llvm-svn: 90209
2009-12-01 05:55:20 +00:00
Daniel Dunbar c70c39300f clang -cc1: Move CompilerInvocation deserialization into CompilerInvocation.cpp,
where it belongs.

llvm-svn: 90198
2009-12-01 03:16:53 +00:00
Daniel Dunbar a74f8ff15c 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.
llvm-svn: 90127
2009-11-30 08:42:00 +00:00
Daniel Dunbar 05762b1344 Add TextDiagnosticBuffer::FlushDiagnostics, for forwarding the buffered diagnostics to a different diagnostics engine.
llvm-svn: 90125
2009-11-30 08:41:34 +00:00
Daniel Dunbar 8e70505692 Eliminate CodeGenOptions::TimePasses.
llvm-svn: 90118
2009-11-30 08:39:52 +00:00
Daniel Dunbar de18224d9c Eliminate CodeGenOptions::SimplifyLibCalls.
llvm-svn: 90117
2009-11-30 08:39:32 +00:00
Chris Lattner 710bb87147 Fix PR5633 by making the preprocessor handle the case where we can
stat a file but where mmaping it fails.  In this case, we emit an
error like:
t.c:1:10: fatal error: error opening file '../../foo.h'

instead of "cannot find file".

llvm-svn: 90110
2009-11-30 04:18:44 +00:00
Daniel Dunbar ecd0444e8c Simplify.
llvm-svn: 90091
2009-11-29 20:58:39 +00:00
Kovarththanan Rajaratnam 5505dff8af 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

llvm-svn: 90073
2009-11-29 09:57:35 +00:00
Alexis Hunt 3d221f2fce Add DeclarationName support for C++0x operator literals. They should now work as
function names outside of templates - they'll probably cause some damage there as
they're largely untested.

llvm-svn: 90064
2009-11-29 07:34:05 +00:00
Daniel Dunbar a1b02a2380 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.
llvm-svn: 90063
2009-11-29 07:18:39 +00:00
Daniel Dunbar 0317c4c5b7 Add clang -cc1 parsing for LangOptions.
- This is the last major parsing piece, main FIXMEs remain.

llvm-svn: 90059
2009-11-29 05:52:21 +00:00
Daniel Dunbar 75fa84ebc6 Change LangOptions::ObjCConstantStringClass to an std::string to avoid worrying about the lifetime.
llvm-svn: 90052
2009-11-29 02:38:47 +00:00
Daniel Dunbar 9eac065e67 Move MainFileName option variable into CodeGenOptions instead of LangOptions.
llvm-svn: 90051
2009-11-29 02:38:34 +00:00
Benjamin Kramer 16634c2c5a Remove VISIBILITY_HIDDEN from anonymous namespaces in libFrontend.
llvm-svn: 90033
2009-11-28 10:07:24 +00:00
Kovarththanan Rajaratnam b1034f7a24 Don't call exit(). llvm::llvm_report_error() will do just that
llvm-svn: 90031
2009-11-28 09:11:46 +00:00
Gabor Greif d2add35d9d typo
llvm-svn: 89949
2009-11-26 15:18:50 +00:00
Gabor Greif 40762fec73 issue a friendlier error if someone tries to send precompiled header to '-' (stdout)
this brings the error on
  clang -c foo.h -o -
closer to
  clang -c foo.h -o /dev/null

llvm-svn: 89948
2009-11-26 14:35:28 +00:00
Daniel Dunbar e0d81f2237 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.

llvm-svn: 89919
2009-11-26 02:14:31 +00:00
Daniel Dunbar 81fe60b787 Add clang -cc1 parsing for preprocessor options.
llvm-svn: 89917
2009-11-26 02:14:07 +00:00
Daniel Dunbar cbc693579c Add clang -cc1 parsing for header search options.
llvm-svn: 89916
2009-11-26 02:13:54 +00:00
Fariborz Jahanian 04b258cc9e Allow user re-definition of SEL as well as accessing its fields.
This fixes pr5611.

llvm-svn: 89895
2009-11-25 23:07:42 +00:00
Ted Kremenek de820039b6 Call GRExprEngine::setTransferFunctions() after registering all Checkers. This allows GRTransferFuncs::RegisterChecks() to always be called after all checkers have been registered.
llvm-svn: 89887
2009-11-25 21:58:39 +00:00
Ted Kremenek 916061f613 Consolidate logic in ActionInlineCall by having it call ActionGRExprEngine instead of replicating most of its logic (and missing pieces).
llvm-svn: 89886
2009-11-25 21:55:23 +00:00
Ted Kremenek d0fe8047dd Make RegisterInternalChecks() part of GRExprEngine's private implementation by making it a static function within GRExprEngine.cpp.
llvm-svn: 89884
2009-11-25 21:51:20 +00:00
Ted Kremenek efb5003f95 Register internal checks with GRExprEngine when it is constructed, not manually in AnalysisConsumer.cpp.
llvm-svn: 89883
2009-11-25 21:45:48 +00:00
Daniel Dunbar 750246255d Fix some uses of fprintf/stderr without a prototype.
llvm-svn: 89858
2009-11-25 10:27:48 +00:00
Daniel Dunbar ad2278d74c Add clang -cc1 parsing for frontend options.
llvm-svn: 89856
2009-11-25 10:14:52 +00:00
Alexis Hunt 54a0254887 Parse C++ member check attributes - base_check, hiding, and override.
The attributes are currently ignored.

llvm-svn: 89837
2009-11-25 04:20:27 +00:00
Douglas Gregor 7bab5ff8e7 Eliminate CXXConditionDeclExpr with extreme prejudice.
All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.

llvm-svn: 89817
2009-11-25 00:27:52 +00:00
Douglas Gregor 680f861d74 Clean up the AST for while loops and fix several problems with
cleanups for while loops: 

1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g.,

   while (shared_ptr<WorkInt> p = getWorkItem()) {
         // ...
         }

2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g.,

   while (blah)
     RAIIObject raii(blah+1);

llvm-svn: 89800
2009-11-24 21:15:44 +00:00
Douglas Gregor dcf1962405 Explicitly store the condition variable within switch statements, and
make sure that this variable is destroyed when we exit the switch
statement.

llvm-svn: 89776
2009-11-24 17:07:59 +00:00
Douglas Gregor 633caca353 Explicitly track the condition variable within an "if" statement,
rather than burying it in a CXXConditionDeclExpr (that occassionally
hides behind implicit conversions). Similar changes for
switch, while, and do-while will follow, then the removal of
CXXConditionDeclExpr. This commit is the canary.

llvm-svn: 89717
2009-11-23 23:44:04 +00:00
Daniel Dunbar 8a9fa3af69 Add clang -cc1 parsing of diagnostic options.
llvm-svn: 89716
2009-11-23 23:41:17 +00:00
John Thompson d976d3e552 Put back hard-coded paths for win32 until I figure out what happened to failed tests.
llvm-svn: 89677
2009-11-23 17:49:27 +00:00
Rafael Espindola 962e518da2 Reorder the header search a bit so that it matches gcc exactly:
*) the ../backward dir is the last in libstdc++ to be searched
*) If compiling c++, the c++ headers are searched first

llvm-svn: 89661
2009-11-23 16:31:19 +00:00
Douglas Gregor ed6c744091 Centralize and complete the computation of value- and type-dependence for DeclRefExprs
llvm-svn: 89649
2009-11-23 11:41:28 +00:00
Daniel Dunbar f5835ea2e7 Add clang -cc1 parsing of analyzer options.
llvm-svn: 89629
2009-11-22 22:08:20 +00:00
Ken Dyck adc8511bc8 Define __SIG_ATOMIC_WIDTH__ for use in stdint.h.
llvm-svn: 89597
2009-11-22 15:41:04 +00:00
Fariborz Jahanian 252ba5fb6f This patch implements objective-c's 'SEL' type as a built-in
type and fixes a long-standing code gen. crash reported in
at least two PRs and a radar. (radar 7405040 and pr5025). 
There are couple of remaining issues that I would like for
Ted. and Doug to look at:

Ted, please look at failure in Analysis/MissingDealloc.m.
I have temporarily added an expected-warning to make the
test pass. This tests has a declaration of 'SEL' type which
may not co-exist with the new changes.

Doug, please look at a FIXME in PCHWriter.cpp/PCHReader.cpp.
I think the changes which I have ifdef'ed out are correct. They
need be considered for in a few Indexer/PCH test cases.

llvm-svn: 89561
2009-11-21 19:53:08 +00:00
Alexis Hunt 96d5c76498 Added rudimentary C++0x attribute support.
The following attributes are currently supported in C++0x attribute
lists (and in GNU ones as well):
 - align() - semantics believed to be conformant to n3000, except for
   redeclarations and what entities it may apply to
 - final - semantics believed to be conformant to CWG issue 817's proposed
   wording, except for redeclarations
 - noreturn - semantics believed to be conformant to n3000, except for
   redeclarations
 - carries_dependency - currently ignored (this is an optimization hint)

llvm-svn: 89543
2009-11-21 08:43:09 +00:00
John Thompson c1b70ab9b8 Revised Win32 include path to search highest version in registry, plus platform SDK path
llvm-svn: 89517
2009-11-21 00:15:52 +00:00
Daniel Dunbar 2eaef18e76 Fix refactoro, clang-cc wasn't properly reporting errors when opening an output file failed.
llvm-svn: 89502
2009-11-20 22:32:38 +00:00
Daniel Dunbar 69fd86dd44 Add clang -cc1 parsing of CodeGenOptions.
llvm-svn: 89464
2009-11-20 17:23:30 +00:00
Daniel Dunbar 84e8a249fa Fix some default in the option classes, and some CompilerInvocation argification
errors.

llvm-svn: 89388
2009-11-19 20:54:59 +00:00
Ken Dyck 0138b9e1db Define __WCHAR_WIDTH__ for use in stdint.h.
llvm-svn: 89353
2009-11-19 15:47:58 +00:00
Ken Dyck a1f677c3d1 Add __WINT_WIDTH__ to paramaterize the limits of WINT_MIN and WINT_MAX in
stdint.h.

llvm-svn: 89348
2009-11-19 14:16:57 +00:00
Ken Dyck 575128656e Add __SIZE_WIDTH__ to eventually replace __SIZE_TYPE__ in stdint.h.
llvm-svn: 89346
2009-11-19 13:42:09 +00:00
Ken Dyck 9b25f781c5 Restore __INTMAX_TYPE__, __UINTMAX_TYPE__, __PTRDIFF_TYPE__, and
__INTPTR_TYPE__ as the last is used in the test/CodeGen/const-init.c and all
could potentially be in use in the wild. My apologies.

llvm-svn: 89345
2009-11-19 13:18:59 +00:00
Ken Dyck f982fc0b23 Remove __PTRDIFF_TYPE__ as it is no longer needed by stdint.h. It has been
replaced with __PTRDIFF_WIDTH__.

llvm-svn: 89344
2009-11-19 12:37:14 +00:00
Ken Dyck 056efe0fc7 Add __PTRDIFF_WIDTH__ macro to eventually replace __PTRDIFF_TYPE__ in stdint.h.
llvm-svn: 89342
2009-11-19 12:21:52 +00:00
Ken Dyck cc11129fda Remove __INTPTR_TYPE__ as it is no longer needed by stdint.h, which uses
__INTPTR_WIDTH__ instead.

llvm-svn: 89340
2009-11-19 12:15:31 +00:00
Daniel Dunbar 51cd8f085f Sketch some 'clang -cc1' support, for testing parts of CompilerInvocation.
llvm-svn: 89333
2009-11-19 07:37:51 +00:00
Daniel Dunbar da9e8e225d clang-cc: Remove some more llvm:🆑:init arguments, by only setting values when
the argument is given.

Also, tweak Opt.Sysroot defaulting.

llvm-svn: 89318
2009-11-19 05:32:21 +00:00
Daniel Dunbar d80277895d Change -code-completion-debug-printer to -no-code-completion-debug-printer.
Also, tweak a few help strings and update CompilerInvocation serialization for prev change.

llvm-svn: 89317
2009-11-19 05:32:09 +00:00
Ken Dyck 24cfcf15c3 Predefine __INTPTR_WIDTH__ for future use in stdint.h.
llvm-svn: 89231
2009-11-18 20:05:48 +00:00
Ken Dyck fa01168a5c Remove the __INTMAX_TYPE__ and __UINTMAX_TYPE__ built-in macros as they are no
longer used by stdint.h.

llvm-svn: 89230
2009-11-18 19:51:06 +00:00
Daniel Dunbar f2ce9a217d Use llvm::sys::Path to check isAbsolute, instead of hard coding. Also, remove random FIXME (?).
llvm-svn: 89229
2009-11-18 19:50:41 +00:00
Ken Dyck c0c98291e0 Predefine __INTMAX_WIDTH__ for the future parameterization of INTMAX macros in
stdint.h.

llvm-svn: 89203
2009-11-18 13:52:57 +00:00
Ted Kremenek 9b124e10a4 Add SourceLocations to ObjCClassDecl for the class identifiers referenced by @class.
llvm-svn: 89170
2009-11-18 00:28:11 +00:00
Ted Kremenek a26da8503c Pass source locations of identifiers referenced by @class through Action::ActOnForwardClassDeclaration().
llvm-svn: 89162
2009-11-17 23:12:20 +00:00
Nuno Lopes b9ac1dc910 recognize .hpp as c++ (needed for ./configure'ing boost)
llvm-svn: 89100
2009-11-17 15:36:35 +00:00
Nuno Lopes 11ab472ba1 add Fedora 11 include path. what a crap..
llvm-svn: 89098
2009-11-17 15:28:35 +00:00
Daniel Dunbar aca02c2730 Simplify CompilerInvocation::toArgs, now that LangOptions handling is more predictable.
llvm-svn: 89074
2009-11-17 09:15:57 +00:00