Commit Graph

778 Commits

Author SHA1 Message Date
John McCall 5677499fbf First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to.  This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.

Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616

llvm-svn: 90965
2009-12-09 09:09:27 +00:00
Ted Kremenek 06ba78d07d Fix crash in DisplayFunction(). ObjCInterfaceDecls can also get passed to this function, but we don't want to display them.
llvm-svn: 90944
2009-12-09 03:45:19 +00:00
Chris Lattner 53d80e2c07 Neil points out that this could be simplified, do it.
llvm-svn: 90927
2009-12-09 02:08:14 +00:00
Daniel Dunbar e07f152e6d Increase inlining threshold at -O3, to match llvm-gcc.
llvm-svn: 90897
2009-12-08 23:15:55 +00:00
Benjamin Kramer c6ad84cb3c Twinify InitHeaderSearch::AddPath and use it in C++ include path generation.
llvm-svn: 90853
2009-12-08 12:38:20 +00:00
Benjamin Kramer 141c7f987a Use StringRefs in InitHeaderSearch::AddDelimitedPaths.
llvm-svn: 90852
2009-12-08 12:11:06 +00:00
John McCall ce54657e95 DeclRefExpr stores a ValueDecl internally.
Template instantiation can re-use DeclRefExprs.

llvm-svn: 90848
2009-12-08 09:08:17 +00:00
Eli Friedman 897bc03305 Small compatibility fix for -print-decl-contexts.
llvm-svn: 90838
2009-12-08 06:22:37 +00:00
Jeffrey Yasskin 567ae47b4a Remove several .c_str() to be forward-compatible with StringRef.
llvm-svn: 90822
2009-12-08 01:46:24 +00:00
Ted Kremenek 6818991d71 Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat block literals as an entry point for analyzer checks.
llvm-svn: 90810
2009-12-07 22:06:12 +00:00
Nuno Lopes c4413fbb88 add fedora 12 include path
llvm-svn: 90772
2009-12-07 17:18:48 +00:00
John McCall bcd035061d DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated variables,
but the results are imperfect.

For posterity, I did:

cat <<EOF > $cmdfile
s/DeclaratorInfo/TypeSourceInfo/g
s/DInfo/TInfo/g
s/TypeTypeSourceInfo/TypeSourceInfo/g
s/SourceTypeSourceInfo/TypeSourceInfo/g
EOF

find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \;
find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \;
find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \;

llvm-svn: 90743
2009-12-07 02:54:59 +00:00
Chris Lattner 9dfed9fdb6 fix -dM with variadic macros, PR5699
llvm-svn: 90735
2009-12-07 01:58:34 +00:00
Chris Lattner 76b4445d6f some code cleanup.
llvm-svn: 90732
2009-12-07 01:42:56 +00:00
Steve Naroff 30484700c5 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=81871
http://llvm.org/viewvc/llvm-project?view=rev&revision=81936
http://llvm.org/viewvc/llvm-project?view=rev&revision=81945

llvm-svn: 90718
2009-12-06 21:14:13 +00:00
Daniel Dunbar a6cb9f21be Fix an off by one in findEndOfWord, which could scan past the end of the string in a corner case.
llvm-svn: 90703
2009-12-06 09:56:18 +00:00
Steve Naroff 287a2bfc03 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=86026

Note: The 'improved debugging' changes weren't integrated (since they were later reverted, since they didn't improve debugging).
llvm-svn: 90693
2009-12-06 01:52:22 +00:00
Steve Naroff 94ed6dc906 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=82174

llvm-svn: 90692
2009-12-06 01:48:44 +00:00
Steve Naroff 2b3843df1b Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=72893

llvm-svn: 90690
2009-12-06 01:33:56 +00:00
Steve Naroff 66aaa39568 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71473

llvm-svn: 90688
2009-12-06 01:02:14 +00:00
Benjamin Kramer acc5fa153d Don't call back() on an empty vector.
llvm-svn: 90678
2009-12-05 22:16:51 +00:00
Steve Naroff ec60b43ee2 Integrate the following from the 'objective-rewrite' branch:
http://llvm.org/viewvc/llvm-project?view=rev&revision=71225
http://llvm.org/viewvc/llvm-project?view=rev&revision=73207
http://llvm.org/viewvc/llvm-project?view=rev&revision=73414

llvm-svn: 90677
2009-12-05 21:43:12 +00:00
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