Ted Kremenek
76c03b4a55
When running the GRSimpleVals analysis, skip functions that do not
...
appear in a file.
llvm-svn: 47491
2008-02-22 19:10:58 +00:00
Ted Kremenek
dbb1a3724c
For now, --grsimple skips analyzing functions in header files.
...
llvm-svn: 47303
2008-02-19 02:33:31 +00:00
Ted Kremenek
0f7130adc4
--grsimple now reports the number of nodes in the ExplodedGraph for
...
an analyzed function.
GRExprEngine now records stores to "uninitialized lvalues" (which are sinks in
the ExplodedGraph).
llvm-svn: 47293
2008-02-19 00:22:37 +00:00
Ted Kremenek
86e793937a
Running -grsimple now emits diagnostics about the time spent analyzing each function. Will
...
probably make this a separate command line option later.
Added "--analyze-function" option to the driver to (gradually) allow different
analyses to only be run on specific functions. Currently only --grsimple uses
this option.
llvm-svn: 47285
2008-02-18 21:21:23 +00:00
Eli Friedman
1d88371663
A couple of msvc compile fixes from the ml; I haven't tested with msvc,
...
but the fixes are reasonable.
llvm-svn: 47224
2008-02-16 23:17:23 +00:00
Lauro Ramos Venancio
10984b2ee9
Set Ubuntu 7.10 c++ include path.
...
llvm-svn: 47186
2008-02-15 22:36:38 +00:00
Ted Kremenek
e161afc4dd
Added --grsimple-view option to clang driver; this is the same as
...
--grsimple except that it visualizes the ExplodedGraph using dot and
outputs the current function being analyzed. --grsimple is now silent
except when it emits diagnostics.
llvm-svn: 47146
2008-02-15 00:35:38 +00:00
Ted Kremenek
d3122cb83c
Renamed GRConstants => GRSimpleVals.
...
Moved driver logic for --grsimple to GRSimpleVals.cpp.
llvm-svn: 47137
2008-02-14 22:36:46 +00:00
Steve Naroff
bff738543d
Move policy on unnamed fields (a Microsoft extension) from Parser::ParseStructDeclaration() to the driver.
...
llvm-svn: 46974
2008-02-11 22:40:08 +00:00
Steve Naroff
5a858df0b3
Fix http://llvm.org/bugs/show_bug.cgi?id=2013 .
...
llvm-svn: 46972
2008-02-11 22:17:33 +00:00
Steve Naroff
a369922449
A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete
...
As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well).
llvm-svn: 46897
2008-02-08 22:06:17 +00:00
Anders Carlsson
5c6c05956e
Put back the top-level asm code; all tests pass now.
...
llvm-svn: 46868
2008-02-08 00:33:21 +00:00
Anders Carlsson
0fae4f56df
Back out 46855 for now, it causes test failures on Darwin.
...
llvm-svn: 46867
2008-02-08 00:23:11 +00:00
Anders Carlsson
bcc3a4bf64
Handle top-level asm declarations.
...
llvm-svn: 46855
2008-02-07 17:19:11 +00:00
Ted Kremenek
d74da0838f
Added proof-of-concept NULL pointer diagnostics to GRConstants.
...
Modified the driver to pass the Diagnostic object to GRConstants.
llvm-svn: 46847
2008-02-07 06:33:19 +00:00
Steve Naroff
b2c80c7c7b
Implement -fms-extensions. This allows us to fuzzy parse non-standard MS constructs used in "windows.h".
...
llvm-svn: 46838
2008-02-07 03:50:06 +00:00
Eli Friedman
1242fff6ec
Make sure to propagate qualifiers through the member operator.
...
llvm-svn: 46830
2008-02-06 22:48:16 +00:00
Chris Lattner
adf1f51fc5
move the codegen ASTConsumer out of the driver into libcodegen,
...
eliminating a bunch of forwarding methods and generally
simplifying things.
llvm-svn: 46792
2008-02-06 02:01:47 +00:00
Chris Lattner
b5eda6253b
pull .ll and .bc writing out of the ASTConsumer destructors into some top
...
level code in clang. This is a cleanup, but does implement "-o" for
-emit-llvm. One effect of this is that "clang foo.c -emit-llvm" will now
emit into foo.ll instead of stdout. Use "clang foo.c -emit-llvm -o -" or
"clang < foo.c -emit-llvm" to get the old behavior.
llvm-svn: 46791
2008-02-06 01:42:25 +00:00
Chris Lattner
8082d870bd
rename ASTSTreamer.{h|cpp} -> ParseAST.{h|cpp}
...
llvm-svn: 46786
2008-02-06 00:23:21 +00:00
Chris Lattner
b1537ebdd4
rewrite some of the type refinement code to eliminate dangling pointers
...
simplify the code and generally make it more robust.
llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Chris Lattner
3ac9699c44
Fix PR1966 by ignoring non-error diagnostics from system headers even if they are
...
*mapped* onto errors.
llvm-svn: 46686
2008-02-03 09:00:04 +00:00
Steve Naroff
e6b7ffd073
Minor API cleanup...
...
llvm-svn: 46649
2008-02-01 22:08:12 +00:00
Steve Naroff
d9dc63f2c5
Remove temporary workaround (thanks to Ted for fixing ObjCAtCatchStmt so quickly:-).
...
llvm-svn: 46648
2008-02-01 21:51:39 +00:00
Steve Naroff
edb5bc6f09
Fix two rewriter bugs with @catch .
...
- Support @catch(...), rather than crash:-)
- Make sure all catch bodies get rewritten. This "fix" is really a workaround until the iterator for the "try" AST is fixed. Will fix this in a separate commit.
llvm-svn: 46644
2008-02-01 20:02:07 +00:00
Chris Lattner
9cc55f5b1f
add some helper methods for removing and replacing text, this makes the
...
rewriter more robust.
llvm-svn: 46622
2008-01-31 19:51:04 +00:00
Chris Lattner
1780a85602
Add a new InsertText method that does the check to see if the insertion was valid. This
...
fixes crashes where the insertion point was in a macro. Instead of crashing, we want
to emit a warning.
llvm-svn: 46621
2008-01-31 19:42:41 +00:00
Chris Lattner
187f626a7c
move a large method out of line
...
llvm-svn: 46620
2008-01-31 19:38:44 +00:00
Chris Lattner
2e0d2600a2
Make rewriter::inserttext return a bool to indicate if it failed.
...
Add a RewriteTest::ReplaceStmt method to factor the 'checking for
rewrite failed + emitting diagnostic if so' code.
llvm-svn: 46619
2008-01-31 19:37:57 +00:00
Chris Lattner
a779d69029
Fix a rewriter crash when the whole body of a foreach is itself
...
rewritten, as in Sema/rewrite-foreach-6.m. Fariborz/Steve,
please review this to see if it is sane.
llvm-svn: 46600
2008-01-31 05:10:40 +00:00
Steve Naroff
7b3579b8de
Abolish a bunch of Xcode inserted tabs.
...
llvm-svn: 46566
2008-01-30 19:17:43 +00:00
Fariborz Jahanian
284011b462
Rewriting of @synchronized. This has one FIXME in it. But this should allow @sychronized to be rewritten.
...
llvm-svn: 46533
2008-01-29 22:59:37 +00:00
Ted Kremenek
8ff7705a6c
Modified LiveVariables to perform all of its base initialization in the ctor,
...
and now we require a FunctionDecl* object so that we can also keep track of
all of the ParmDecls.
Modified clients of LiveVariables to conform to the new interface.
llvm-svn: 46490
2008-01-29 05:13:23 +00:00
Ted Kremenek
997d872375
Driver now passes the top-level FunctionDecl* to GRConstants.
...
Refactoring: for GREngine and GRConstants, pushed references to CFG, ASTContext,
and the top-level FunctionDecl into ExplodedGraphImpl.
llvm-svn: 46475
2008-01-29 00:33:40 +00:00
Steve Naroff
909651a6ed
Add -Wno-rewrite-macros to silence the following warning when using -rewrite-test:
...
xx.m:10:3: warning: rewriting sub-expression within a macro (may not be correct)
llvm-svn: 46462
2008-01-28 21:34:52 +00:00
Chris Lattner
02bf44436f
Make -o work with -E, patch contributed by Shantonu Sen!
...
llvm-svn: 46426
2008-01-27 23:55:11 +00:00
Chris Lattner
3efff5472b
Fix a bug recovering from broken code with a goto that Eli reported.
...
llvm-svn: 46336
2008-01-25 00:01:10 +00:00
Ted Kremenek
33d8285b8d
Added passing "ASTContext" to both GREngine and GRConstants.
...
Added initial support for integer casting operations to GRConstants.
llvm-svn: 46298
2008-01-24 02:02:54 +00:00
Fariborz Jahanian
60a901621f
Fixed a nasty bug which took a while to come up with a test case,
...
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.
llvm-svn: 46279
2008-01-23 20:34:40 +00:00
Chris Lattner
7238225c28
add support for -Wundef.
...
llvm-svn: 46274
2008-01-23 17:19:46 +00:00
Fariborz Jahanian
0a71ad2e07
Problem with ObjC's type-encoding of nested structs causing infinit recursion.
...
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio
111b3ba670
Add Ubuntu 7.10 include path.
...
llvm-svn: 46233
2008-01-21 23:08:35 +00:00
Fariborz Jahanian
eab81cd03f
Synthesize methods with va-arg list correctly.
...
llvm-svn: 46212
2008-01-21 20:14:23 +00:00
Fariborz Jahanian
137d693e09
Fixed comment.
...
llvm-svn: 46185
2008-01-19 01:03:17 +00:00
Steve Naroff
c7d2df23f8
Fix two bugs with an @throw that doesn't have a statement.
...
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-)
- RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception.
llvm-svn: 46184
2008-01-19 00:42:38 +00:00
Fariborz Jahanian
802583656e
Patch to replace #import with #include.
...
llvm-svn: 46183
2008-01-19 00:30:35 +00:00
Fariborz Jahanian
159ee39f4d
Insert #pragma once when rewriting a header file.
...
llvm-svn: 46155
2008-01-18 01:15:54 +00:00
Ted Kremenek
db0b651de9
Shortened driver option for running the GR-constants analysis to --grconstants.
...
llvm-svn: 46076
2008-01-16 18:21:49 +00:00
Ted Kremenek
2e12c2e790
Hooked up the GRConstants analysis to the driver.
...
Fixed some compilation errors with GREngine that showed up during
template instantiation.
llvm-svn: 46074
2008-01-16 18:18:48 +00:00
Fariborz Jahanian
19d42bf0a5
Typo.
...
llvm-svn: 46038
2008-01-16 00:09:11 +00:00
Fariborz Jahanian
b860cbf052
Added support for rewriting of continue/break statements inside ObjC2's foreach-stmt.
...
llvm-svn: 46037
2008-01-15 23:58:23 +00:00
Chris Lattner
15346fae70
avoid pasting L + "foo" into L"foo".
...
llvm-svn: 46000
2008-01-15 05:22:14 +00:00
Chris Lattner
877ca77420
avoid token pasting between identifiers and wide strings:
...
abc+L"foo" -> abc L"foo", not abcL"foo"
llvm-svn: 45999
2008-01-15 05:14:19 +00:00
Steve Naroff
d32419de0d
Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
...
Bug/patch by Eli Friedman!
llvm-svn: 45966
2008-01-14 18:19:28 +00:00
Ted Kremenek
a0a3e9bb07
Change uses of std::cerr/std::cout to llvm::Lcerr/llvm::cout, and remove
...
#include<iostream>.
Patch provided by Sam Bishop.
llvm-svn: 45962
2008-01-14 16:44:48 +00:00
Chris Lattner
38376f1595
Add first pieces of support for parsing and representing
...
extern "C" in C++ mode. Patch by Mike Stump!
llvm-svn: 45904
2008-01-12 07:05:38 +00:00
Chris Lattner
177977ac19
When forming the squigly underline for a diagnostic, make sure to
...
verify that the source range corresponds to the current file, not
just the current line. This allows us to emit:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ^
instead of:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ~ ^
for PR1906 (note the leading ~).
Thanks to Neil for noticing this.
llvm-svn: 45901
2008-01-12 06:43:35 +00:00
Fariborz Jahanian
af5d80cba5
Avoid redefinition of __objcFastEnumerationState
...
llvm-svn: 45842
2008-01-10 23:04:06 +00:00
Chris Lattner
2cbf2f39ee
add support for the GCC -include option.
...
llvm-svn: 45810
2008-01-10 01:53:41 +00:00
Chris Lattner
bceeefdc9c
Fix some 80 col violations
...
llvm-svn: 45808
2008-01-10 01:43:14 +00:00
Chris Lattner
d2cdb97747
Ted apparently likes crazy whitespace at the end of line. Crush his spirit by
...
removing them, fitting the file into 80 columns. :)
llvm-svn: 45807
2008-01-10 01:41:55 +00:00
Fariborz Jahanian
7262fca0a6
Put return type of synthesize method on same line as method declaration, space after method declaration header.
...
llvm-svn: 45806
2008-01-10 01:39:52 +00:00
Fariborz Jahanian
82ae0152a7
Allow messaging expression as foreach's collection expression.
...
llvm-svn: 45793
2008-01-10 00:24:29 +00:00
Fariborz Jahanian
6fa7516bc9
Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
...
llvm-svn: 45777
2008-01-09 18:15:42 +00:00
Fariborz Jahanian
22f2347791
Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
...
llvm-svn: 45776
2008-01-09 17:50:00 +00:00
Fariborz Jahanian
b7e7ee9ff3
Typo fixed.
...
llvm-svn: 45771
2008-01-09 01:25:54 +00:00
Fariborz Jahanian
965a8961c7
Patch to rewrite ObjC2's foreach-stmt.
...
llvm-svn: 45760
2008-01-08 22:06:28 +00:00
Ted Kremenek
7e41c29a86
Added most of the boilerplate to the driver needed to run the graph-reachability
...
constant propagation analysis.
llvm-svn: 45747
2008-01-08 18:04:06 +00:00
Fariborz Jahanian
dc917b9e07
Patch to start rewriting of ObjC2's foreach statement (work in progress).
...
llvm-svn: 45721
2008-01-07 21:40:22 +00:00
Ted Kremenek
1b0ea82459
Substituted all instances of the string "Objc" for "ObjC". This fixes
...
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.
llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Chris Lattner
4899a6aa6a
Fix PR1897, patch by Wilhansen Li
...
llvm-svn: 45593
2008-01-04 19:12:28 +00:00
Chris Lattner
266a2ff3ac
Compute the proper sourcerange for an CompoundLiteralExpr.
...
llvm-svn: 45504
2008-01-02 21:46:24 +00:00
Chris Lattner
54bb810997
Refactor the decl printer, patch by Mike Stump!
...
llvm-svn: 45497
2008-01-02 21:04:16 +00:00
Nate Begeman
16a3a9d5f9
Rename stats to print-stats to avoid conflicting with llvm's
...
stats statistic when clang is built as a dylib.
llvm-svn: 45441
2007-12-30 01:38:50 +00:00
Chris Lattner
5b12ab8c93
Don't attribute in file headers anymore. See llvmdev for the
...
discussion of this change.
llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Christopher Lamb
2b84813441
Make output files binary mode for -emit-llvm-bc
...
llvm-svn: 45348
2007-12-24 23:49:33 +00:00
Christopher Lamb
d01dea749e
Almost the best possible handling of stdin/stdout for llvm-emit-bc!
...
llvm-svn: 45346
2007-12-24 20:59:36 +00:00
Christopher Lamb
1c0f5d2436
Better handing of stdin/stdout for -emit-llvm-bc
...
llvm-svn: 45345
2007-12-24 20:56:07 +00:00
Christopher Lamb
5a3416409f
Allow bitcode output to be redirected to stdout.
...
llvm-svn: 45340
2007-12-24 03:23:55 +00:00
Seo Sanghyeon
76270e6be6
Implement -emit-llvm-bc option
...
llvm-svn: 45339
2007-12-24 01:52:34 +00:00
Chris Lattner
b907c3fca1
remove use of alloca.
...
llvm-svn: 45329
2007-12-23 01:40:15 +00:00
Anton Korobeynikov
03f8a3630d
Unbreak mingw build
...
llvm-svn: 45328
2007-12-23 01:19:32 +00:00
Ted Kremenek
bf593f81fa
Directory restructing of Analysis files.
...
Created include/clang/Analysis/Analyses directory.
- Moved LiveVariables.h and UninitializedValues.h into this dir.
Moved ExprDeclBitVector.h into Analysis/Support.
Updated all clients who use these headers to reflect the new paths.
llvm-svn: 45292
2007-12-21 21:42:19 +00:00
Ted Kremenek
71d643f8b1
Converted uses of scoped_ptr to OwningPtr.
...
llvm-svn: 45265
2007-12-20 19:47:16 +00:00
Ted Kremenek
371efafb94
Created initial implementation of "BuildSerializer", and ASTConsumer
...
which serializes ASTs to a common output directory. This ASTConsumer
is invoked using a combination of "-o" and "-serialize" from the driver.
llvm-svn: 45241
2007-12-20 00:34:58 +00:00
Ted Kremenek
ca07147851
Split serialization ASTConsumers into two consumers: SingleFileSerializer and
...
BuildSerializer. The former serializes a single translation unit to a
corresponding .ast file. The second serializes ASTs to a common emission
direction. The latter is not fully implemented yet.
llvm-svn: 45232
2007-12-19 23:49:37 +00:00
Ted Kremenek
96e05d4f31
Added methods createMainFileID() and createMainFileIDForMemBuffer() to
...
SourceManager to allow SourceManager to directly intern the MainFileID
when it is created. Removed setMainFileID().
llvm-svn: 45231
2007-12-19 23:48:45 +00:00
Ted Kremenek
230bd918b2
Interned MainFileID within SourceManager. Since SourceManager is referenced by
...
both Preprocessor and ASTContext, we no longer need to explicitly pass
MainFileID around in function calls that also pass either Preprocessor or
ASTContext. This resulted in some nice cleanups in the ASTConsumers and the
driver.
llvm-svn: 45228
2007-12-19 22:51:13 +00:00
Ted Kremenek
f7bfae6b45
Typo fix.
...
llvm-svn: 45227
2007-12-19 22:32:34 +00:00
Ted Kremenek
9a53275918
Added storage of the FileID of the the main source file of a translation unit
...
in SourceManager.
llvm-svn: 45225
2007-12-19 22:29:55 +00:00
Ted Kremenek
6c7807716b
Removed "SourceFile" from TranslationUnit. This same information will (soon)
...
be available by querying the SourceManager within the ASTContext referenced by
the TranslationUnit.
llvm-svn: 45223
2007-12-19 22:24:34 +00:00
Ted Kremenek
aff2343af3
Cleaned up "-o" option to print "-o=<path>" instead of "-o=<string>" when
...
doing clang --help.
llvm-svn: 45215
2007-12-19 19:50:41 +00:00
Ted Kremenek
6c0b224011
Added "-o" option to driver. ASTConsumers will need to be gradually
...
rewired to utilize this option.
Renamed option --serialize-ast --serialize.
llvm-svn: 45213
2007-12-19 19:47:59 +00:00
Ted Kremenek
0061aeb316
Removed storing inode and device number in TranslationUnit.
...
Added "SourceFile" string to TranslationUnit to record corresponding
source file.
Updated serialization of TranslationUnits and logic in the driver to
correctly pass the source file information to the serializer.
llvm-svn: 45211
2007-12-19 19:27:38 +00:00
Steve Naroff
7e718bb3fd
Soften the macro rewrite error to a warning (and change the text).
...
llvm-svn: 45209
2007-12-19 19:16:49 +00:00
Ted Kremenek
6c3777c319
Moved generation of the name of the serialized AST file into
...
CreateASTSerializer.
llvm-svn: 45201
2007-12-19 17:25:59 +00:00
Steve Naroff
55cb4be8ae
Emit errors when attempting to rewrite ObjC expressions that originate from a macro expansion.
...
We plan on fixing this and removing this restriction after the break...
llvm-svn: 45200
2007-12-19 14:32:56 +00:00
Ted Kremenek
f70d24d2ae
Moved ReadBitcodeFile and EmitBitcodeFile out of TranslationUnit and made them
...
the standalone functions ReadASTBitcodeFile and EmitASTBitcodeFile
respectively.
llvm-svn: 45180
2007-12-18 21:44:50 +00:00
Ted Kremenek
25dbd71a4c
Fixed broken includes introduced by recent (incomplete) patch to
...
TranslationUnit.
llvm-svn: 45177
2007-12-18 21:36:21 +00:00
Ted Kremenek
879b75018f
Moved TranslationUnit from Driver to AST library.
...
llvm-svn: 45175
2007-12-18 21:34:28 +00:00
Fariborz Jahanian
9f0e310861
Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
...
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Fariborz Jahanian
24cb52c9b0
Patch to implemented objective-c's dynamic object pointer qualified with
...
the protocol list (id<P,...> types).
llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Chris Lattner
4ffe46cbdf
Start reading the headermap header, drop the 'errorstr' argument to
...
the create method.
llvm-svn: 45109
2007-12-17 18:34:53 +00:00
Fariborz Jahanian
77b713b5d3
Also fixed similar regression for class methods, as well as more indentations.
...
llvm-svn: 45107
2007-12-17 18:07:01 +00:00
Chris Lattner
8d720d083a
Sink getName into DirectoryLookup to simplify the client in clang.
...
llvm-svn: 45106
2007-12-17 17:57:27 +00:00
Fariborz Jahanian
5f6409532b
Fixed a regression caused by refactoring of some meta-data generation routines using iteratgors.
...
Also fixed indentation problems.
llvm-svn: 45105
2007-12-17 17:56:10 +00:00
Ted Kremenek
73e921fdf2
Fixed 80 col violation.
...
llvm-svn: 45104
2007-12-17 17:50:39 +00:00
Ted Kremenek
5aa66bdfd6
Added driver option -Wno-format-nonliteral to silence format string related
...
warnings. This flag is the inverse of to GCC's -Wformat-nonliteral option (in
the clang driver, these warnings are on by default).
Patch provided by Shantonu Sen.
llvm-svn: 45103
2007-12-17 17:50:07 +00:00
Chris Lattner
faebb62651
Unbreak -v with framework paths. Patch by Shantonu Sen.
...
llvm-svn: 45102
2007-12-17 17:42:26 +00:00
Chris Lattner
f62f75895f
as it turns out, frameworks and headermaps are orthogonal. Make this so in
...
the internal representation. This also fixes a bug where -I foo -F foo would
not search foo as both a normal and framework include dir.
llvm-svn: 45092
2007-12-17 07:52:39 +00:00
Chris Lattner
dd00e625d2
add a portability fixme.
...
llvm-svn: 45091
2007-12-17 06:51:34 +00:00
Chris Lattner
3e206b3a0e
teach RemoveDuplicates about header maps.
...
llvm-svn: 45090
2007-12-17 06:44:29 +00:00
Chris Lattner
c4ba38ed1e
Step #1 in adding headermap support to clang.
...
llvm-svn: 45089
2007-12-17 06:36:45 +00:00
Chris Lattner
899ff4a26d
rearrange some code and make it more efficient.
...
llvm-svn: 45087
2007-12-17 05:59:27 +00:00
Chris Lattner
39911a2258
swtich to smallptrset, which is more efficient than std::set.
...
llvm-svn: 45065
2007-12-15 23:20:07 +00:00
Chris Lattner
d6658d932b
make clang -v output more similar to gcc's -v output.
...
llvm-svn: 45064
2007-12-15 23:11:06 +00:00
Chris Lattner
60a288ab19
simplify the interfaces to ProcessInputFile and InitializePreprocessor
...
llvm-svn: 45060
2007-12-15 20:48:40 +00:00
Steve Naroff
3ce37a6b8e
- Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class.
...
- Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage.
- Various changes to convert all clients to the above API's...
llvm-svn: 45046
2007-12-14 23:37:57 +00:00
Ted Kremenek
31dcdb312b
Add check in the driver to see if a serialized AST file has been successfully
...
deserialized.
llvm-svn: 45006
2007-12-13 18:11:11 +00:00
Ted Kremenek
685dc9b56e
Changed set of top-level decls from a list to a vector.
...
llvm-svn: 45005
2007-12-13 17:54:02 +00:00
Ted Kremenek
15ddcef648
Changed -serialize-ast to not create a temporary directory, but instead
...
create a .ast file in the current working directory. This mirrors the behavior
of the -c option for gcc. Later we should add the ability to write the
serialized file anywhere.
llvm-svn: 45004
2007-12-13 17:50:11 +00:00
Chris Lattner
60af5f3b82
Set target data layout info in module.
...
llvm-svn: 45003
2007-12-13 17:34:31 +00:00
Ted Kremenek
ce8d55b087
Implemented -serialize-ast option for the driver. This is not really tested
...
and is a work in progress.
llvm-svn: 44967
2007-12-13 00:37:31 +00:00
Ted Kremenek
8fdd3d95eb
Implemented prototype mode where the driver can operate on serialized ASTs
...
instead of source files.
llvm-svn: 44962
2007-12-12 23:41:08 +00:00
Ted Kremenek
1daa3cfbae
TargetInfo no longer includes a reference to SourceManager.
...
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:
FullLoc.getManager().someMethod(FullLoc.getLocation());
instead we have:
FullLoc.someMethod();
Modified TextDiagnostics (and related classes) to use this short-hand.
llvm-svn: 44957
2007-12-12 22:39:36 +00:00
Ted Kremenek
6f6ff37b04
Moved construction of TargetInfo objects out of the Driver
...
and into the "Basic" library. TargetInfo objects are now
constructed from triples by calling the static method
TargetInfo::CreateTargetInfo.
llvm-svn: 44940
2007-12-12 18:05:32 +00:00
Chris Lattner
30d23e8289
more cleanups changing things like getInstanceVariables to iterators.
...
llvm-svn: 44930
2007-12-12 07:56:42 +00:00
Chris Lattner
31bc07e6cf
resolve some fixmes and clean up some code by eliminating the get*Vars apis to some classes and use iterators instead.
...
llvm-svn: 44927
2007-12-12 07:46:12 +00:00
Chris Lattner
2d39e07112
Simplify some code, don't force the triple to a darwin triple if non-darwin.
...
llvm-svn: 44911
2007-12-12 05:01:48 +00:00
Ted Kremenek
fc095b1669
Moved creation of SourceManager, HeaderSearch, TargetInfo, and LangOptions
...
into the loop that processes input files. These will soon become translation
unit specific (with the exception of LangOptions).
llvm-svn: 44893
2007-12-11 23:28:38 +00:00
Fariborz Jahanian
16e703ade5
80-column please.
...
llvm-svn: 44888
2007-12-11 23:04:08 +00:00
Ted Kremenek
89fbadd3be
Modified the internals of Diagnostic and DiagnosticClient to use
...
SourceManager*'s instead of SourceManager&'s. This allows the client specify a
NULL SourceManager when using a default constructed SourceLocation. Thus the
SourceManager can be NULL when the SourceLocation's isValid() == false.
The interface to most clients of Diagnostic remains the same.
Diagnostic::Report() is overload to either accept a SourceLocation and a
SourceManager&, or neither. Thus clients that do not have a SourceManager
cannot specify a SourceLocation.
Modified TextDiagnostics* to use this new interface.
Modified the driver to not passed in SourceManager when warning about "-I-".
llvm-svn: 44887
2007-12-11 22:57:35 +00:00
Fariborz Jahanian
4e56ed5fab
Implemented rewriting of protocol-qualified global variable types.
...
Re-implemented some of rewriting of protocol-qualified function
argument types to support it in its generality.
llvm-svn: 44886
2007-12-11 22:50:14 +00:00
Ted Kremenek
d4e5fbacab
Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
...
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.
Modified all users of Diagnostics to comply with this new interface.
Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).
Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.
llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Fariborz Jahanian
c86ee9ce90
Refactor Rewritetest::RewriteObjcQualifiedInterfaceTypes in preparation for more
...
general use.
llvm-svn: 44876
2007-12-11 19:56:36 +00:00
Chris Lattner
29a16af8de
properly namespacify.
...
llvm-svn: 44845
2007-12-11 04:36:28 +00:00
Anders Carlsson
895af08562
Move target specific builtin IDs to TargetBuiltins.h so that they can be used by CGBuiltin.cpp
...
llvm-svn: 44748
2007-12-09 23:17:02 +00:00
Chris Lattner
3ed83c1c0f
The flags on tokens indicate whether they are the start of a *physical* line,
...
not the start of a logical line. Be careful about this distinction, which
affects when newlines are printed and when paste-avoidance happens, etc.
This fixes PR1848, thanks to Neil for noticing this!
llvm-svn: 44743
2007-12-09 21:11:08 +00:00
Chris Lattner
84f450789a
Fix a pretty big but subtle bug counting the number of newlines to emit.
...
This would cause us to emit different code (in -E mode) for these two files:
---
#define t(x) x
t(a
3)
---
#define t(x) x
t(a
3)
---
In one case, -E would print "a\n3", in the other it printed "a3". Now
it prints "a3" for both.
This is part of PR1848.
llvm-svn: 44742
2007-12-09 20:45:43 +00:00
Chris Lattner
9c4aad2dba
avoid ///usr/include/foo.h, patch by Sean Middleditch
...
llvm-svn: 44731
2007-12-09 00:39:55 +00:00
Anders Carlsson
050f494f66
Add getTargetPrefix to TargetInfo, to be used with target specific intrinsics.
...
llvm-svn: 44712
2007-12-08 19:32:57 +00:00
Steve Naroff
1f6ed92dbb
Omit the field name when including the super class structure template.
...
This allows us to access a superclasses ivars without deriving the absolute path.
The comments below say a bit more...
llvm-svn: 44688
2007-12-07 22:15:58 +00:00
Fariborz Jahanian
ff6a455c12
Implemented when static typing is combined with protocols and use as receiver
...
type.
llvm-svn: 44685
2007-12-07 21:21:21 +00:00
Fariborz Jahanian
33c0e815f3
Patch for rewriting of @protocol.
...
llvm-svn: 44681
2007-12-07 18:47:10 +00:00
Steve Naroff
b2f8ff153d
Rewrite 'super' within a class method. This required some minor tweaks to the front-end.
...
llvm-svn: 44673
2007-12-07 03:50:46 +00:00
Fariborz Jahanian
227c0d13bc
On Steve's suggestion, moved handling of use of undeclared method in a message
...
to rewriter (my previous patch).
llvm-svn: 44665
2007-12-06 19:49:56 +00:00
Ted Kremenek
260d01d6e6
Subdivided the function InitializeBaseLanguage into InitializeBaseLanguage,
...
GetLanguage, and InitializeLangOptions. The goal is to break up this logic
into atomic units of functionality that can later be refactored into better
driver logic that is capable of handling a mixture of source files of
different languages.
llvm-svn: 44642
2007-12-05 23:49:08 +00:00
Chris Lattner
2ed8f31f2f
Avoid passing Diags into InitializeIncludePaths.
...
llvm-svn: 44639
2007-12-05 23:24:17 +00:00
Ted Kremenek
e095881856
Converted SerializationTest (--test-pickling) to use the new TranslationUnit
...
class to serialize and deserialize translation units.
llvm-svn: 44634
2007-12-05 22:08:43 +00:00
Steve Naroff
ff9f8efe4d
Make sure the class methods get attached to the metaclass object.
...
Need to query the implementation, not the interface...
llvm-svn: 44633
2007-12-05 21:49:40 +00:00
Ted Kremenek
62f4302ec7
Added "TranslationUnit" class that will be used to provide an interface
...
for serializing/deserializing ASTs that is decoupled from the logic
in SerializationTest (which will soon be rewritten to use this interface).
llvm-svn: 44631
2007-12-05 21:36:08 +00:00
Ted Kremenek
dd1a7aade5
Modified: CreateTargetInfo(). Now takes Diagnostic* instead of Diagnostic&.
...
Modified: ctor of SerializationTest: Now takes LangOptions argument. We
will eventually serialize this as well.
llvm-svn: 44630
2007-12-05 21:34:36 +00:00
Chris Lattner
36021a9cc1
I'm apparently the only sad lonely ppc user left :)
...
llvm-svn: 44622
2007-12-05 18:41:05 +00:00
Ted Kremenek
a4c13bd94b
Moved creation of ASTConsumers that can operate on both freshly-parsed and
...
deserialized ASTs into the function CreateASTConsumer(). This function
is called by ProcessInputFile, and soon the logic that processes deserialized
ASTs.
llvm-svn: 44618
2007-12-05 18:27:04 +00:00
Fariborz Jahanian
d5db92ba97
Changed type-cast of "struct objc_super"'s 2nd initializer to match definition of
...
"struct objc_super".
llvm-svn: 44616
2007-12-05 17:29:46 +00:00
Ted Kremenek
166e505d27
Added serialization support of SourceManager to the clang driver.
...
llvm-svn: 44592
2007-12-05 00:26:13 +00:00
Steve Naroff
0317aeb4b6
Add the definition of objc_super...
...
llvm-svn: 44588
2007-12-04 23:59:30 +00:00
Fariborz Jahanian
1e34ce1045
Type-cast initializers for "struct objc_super" parameter to avoid warning.
...
llvm-svn: 44583
2007-12-04 22:32:58 +00:00
Fariborz Jahanian
31e1850694
Don't assert if objc.h not declared when rewriting.
...
llvm-svn: 44580
2007-12-04 21:47:40 +00:00
Fariborz Jahanian
f256b48bc7
Removed a "TODO" comment as objc1 runtime does not need to do the "TODO".
...
llvm-svn: 44577
2007-12-04 19:31:56 +00:00
Ted Kremenek
0c2bea2909
Removed searching for "darwin" keyword in target triple. We don't really support
...
any alternative targets at this point other than "darwin," so we now default to
Darwin targets (for now).
llvm-svn: 44572
2007-12-04 17:07:35 +00:00
Ted Kremenek
9c26202c76
Fixed order of operands to strstr call.
...
llvm-svn: 44561
2007-12-03 23:25:59 +00:00
Ted Kremenek
eead4052e9
For target processing, on non-Darwin systems instead of using the host triple,
...
we default to "i386-apple-darwin". This is an interim solution.
Removed processing of "linux" triples from Targets.cpp, since we don't have
any sensical Linux target support (yet).
Cleaned up error processing of targets; added better diagnostics.
llvm-svn: 44560
2007-12-03 23:23:21 +00:00
Fariborz Jahanian
68c06b2d2c
Change <Objc/objc.h> to <objc/objc.h>
...
llvm-svn: 44556
2007-12-03 23:04:29 +00:00
Ted Kremenek
8e3a2a93aa
Implemented serialization of TargetInfo.
...
SerializationTest (subclass of ASTConsumer) now takes Diagnostics& in its ctor.
llvm-svn: 44555
2007-12-03 22:48:14 +00:00
Fariborz Jahanian
d0d2bd5089
Fixed a bug exposed by referencing an ivar field using component reference syntax.
...
llvm-svn: 44553
2007-12-03 22:25:42 +00:00
Ted Kremenek
68fcff9bfa
Few cleanups to patch 44551:
...
http://llvm.org/viewvc/llvm-project?view=rev&revision=44551
Removed debugging fprintfs for printing targets.
Implemented error messages when processing invalid targets.
llvm-svn: 44552
2007-12-03 22:11:31 +00:00
Ted Kremenek
b061554caa
Implemented initial support for "-triple" option to the clang driver. This
...
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).
The new behavior is as follows:
(1) If the user does not specify -triple:
(a) If no -arch options are specified, the target triple used is the host
triple (in llvm/Config/config.h).
(b) If one or more -arch's are specified (and no -triple), then there is
one triple for each -arch, where the specified arch is substituted
for the arch in the host triple. Example:
host triple = i686-apple-darwin9
command: clang -arch ppc -arch ppc64 ...
triples used: ppc-apple-darwin9 ppc64-apple-darwin9
(2) The user does specify a -triple (only one allowed):
(a) If no -arch options are specified, the triple specified by -triple
is used. E.g clang -triple i686-apple-darwin9
(b) If one or more -arch options are specified, then the triple specified
by -triple is used as the primary target, and the arch's specified
by -arch are used to create secondary targets. For example:
clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
has the following targets:
i686-apple-darwin9 (primary target)
ppc-apple-darwin9
ppc64-apple-darwin9
Other changes related to the changes to the driver:
- TargetInfoImpl now includes the triple string.
- TargetInfo::getTargetTriple returns the triple for its primary target.
- test case test/Parser/portability.c has been updated because "-arch linux" is
no longer valid ("linux" is an OS, not an arch); instead we use a bogus
architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.
llvm-svn: 44551
2007-12-03 22:06:55 +00:00
Chris Lattner
e5a91b4924
Fix an ast-print/ast-dump bug.
...
llvm-svn: 44550
2007-12-03 21:43:25 +00:00
Fariborz Jahanian
4f76f22975
Support for rewriteing of messaging of methods which return float.
...
llvm-svn: 44548
2007-12-03 21:26:48 +00:00
Fariborz Jahanian
9e7b848ac8
Added support for messagings which return a structure-value.
...
(Also fixed a regression caused by recent changes to synthesis of structs).
llvm-svn: 44540
2007-12-03 19:17:29 +00:00
Chris Lattner
c8dbe1e5d6
Warn about unsupported codegen with the diags machinery, giving us:
...
t.c:3322:5: warning: cannot codegen this yet
__asm__ ("bswap %0" : "+r" (_data));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
instead of:
Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)
llvm-svn: 44501
2007-12-02 01:40:18 +00:00
Chris Lattner
f3a59a1fb8
fix a crash when the rewriter would scan off the beginning of the file.
...
llvm-svn: 44499
2007-12-02 01:13:47 +00:00
Chris Lattner
e6535cfdd2
add support for custom client-specific diagnostics. As a testcase, make the
...
rewriter emit this error if it fails to rewrite an @encode:
t.m:17:9: error: rewriter could not replace sub-expression due to macros
c = ENC(char *)[2] + 4;
^~~~~~~~~~~
... where ENC is: #define ENC @encode
llvm-svn: 44498
2007-12-02 01:09:57 +00:00
Chris Lattner
4431a1b19b
start partitioning the diagnostics into two classes: those
...
that are builtin and those that are aren't. This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.
llvm-svn: 44473
2007-11-30 22:53:43 +00:00
Ted Kremenek
c9bcda94ae
Implemented serialization of SelectorTable and Selectors.
...
Modified serialization of IdentifierTable to self-register itself with
the Deserializer.
llvm-svn: 44471
2007-11-30 22:46:56 +00:00
Chris Lattner
e9c810c87c
pass diagnostics into the rewrite test client.
...
llvm-svn: 44468
2007-11-30 22:25:36 +00:00
Anders Carlsson
e1af1d20ef
Support lax vector conversions.
...
llvm-svn: 44449
2007-11-30 04:21:22 +00:00
Ted Kremenek
870600d625
Only serialize top-level decls that appear at the head of a decl chain.
...
llvm-svn: 44438
2007-11-29 19:04:54 +00:00
Ted Kremenek
1150e25901
Enhanced serialization testing by also pretty-printing CFGs constructed from ASTs
...
both before and after serialization/deserialization. If the CFGs between the pre-
and post- serialized/deserialized ASTs differ, the serialization has failed.
llvm-svn: 44429
2007-11-29 01:24:25 +00:00
Steve Naroff
197616c3a8
Several fixes/simplifications surrounding how we stream top-level decl AST's.
...
The following code...
typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;
struct Y { int A; };
struct X { int A; } D;
struct X E, F;
...now produces the following output...
> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'
...which is much more accurate than the previous -ast-print output...
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'
llvm-svn: 44421
2007-11-28 22:54:11 +00:00
Ted Kremenek
5933768bec
Converted AST Pretty-Printer to use iostreams instead of FILE*. This fixes
...
a bug where the statement pretty-printer used iostreams but the AST printer
did not. This was an issue when dumping ASTs to something other than stderr.
Updated SerializationTest to use the new iostreams interface for the AST printer.
llvm-svn: 44417
2007-11-28 21:32:21 +00:00
Ted Kremenek
ac76a41717
Modified --test-pickling to perform an actual cross-check of serialized ASTs:
...
(1) Parsed ASTs are pretty-printed to a text file.
(2) The ASTs are serialized to disk.
(3) The ASTs are deserialized from disk.
(4) The deserialized ASTs are pretty-printed to a text file.
(5) The two pretty-printed files are compared. If they are different, the test
fails.
llvm-svn: 44411
2007-11-28 19:21:47 +00:00
Anders Carlsson
0e136ec1d3
Add correct types for the last remaining intrinsics.
...
llvm-svn: 44396
2007-11-28 06:09:44 +00:00
Chris Lattner
fb30009465
Implement support for -fwritable-strings and make the code generator
...
merge string literals when it is not provided.
llvm-svn: 44394
2007-11-28 05:34:05 +00:00
Anders Carlsson
299f2fc648
Add more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without having to do -arch ppc.
...
llvm-svn: 44392
2007-11-28 05:19:59 +00:00
Ted Kremenek
7c81bdd4e7
Migrated static functions that print decls into a DeclPrinter class,
...
which is now used (or subclasssed) by the ASTConsumers. This new class
stores a FILE* that is used for writing, instead of just hardwiring output
to stderr (it defaults to stderr if no FILE* is provided).
Modified CreateASTPrinter() to accept a FILE* for printing.
llvm-svn: 44377
2007-11-27 21:46:50 +00:00
Anders Carlsson
61d6f8d6c3
Add builtin type signature support for vector types. Add correct type signatures for a bunch of MMX builtins. We now parse all the intrinsics in mmintrin.h
...
llvm-svn: 44357
2007-11-27 07:22:09 +00:00
Anders Carlsson
f511f646a4
Add more semantic analysis for inline asm statements.
...
llvm-svn: 44349
2007-11-27 04:11:28 +00:00
Fariborz Jahanian
96502afb6f
Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
...
llvm-svn: 44335
2007-11-26 20:59:57 +00:00
Fariborz Jahanian
a883d6ed89
Patch to fix a regression caused by recent rewrite changes.
...
A potential API bug in ReplaceText pending (A FIXME is added).
llvm-svn: 44333
2007-11-26 19:52:57 +00:00
Bill Wendling
8da1db4f34
The checking for the delimiters of expected error/warning messages was
...
looking only for { and } instead of {{ and }}. Changed it to check for
this explicitly.
llvm-svn: 44326
2007-11-26 08:26:20 +00:00
Anders Carlsson
c163657f2f
Forgot some X86 registers
...
llvm-svn: 44309
2007-11-25 00:23:10 +00:00
Anders Carlsson
5fa3f348f7
Add tables for GCC register names and aliases. This will be used for inline asm
...
llvm-svn: 44308
2007-11-24 23:38:12 +00:00
Steve Naroff
c1e6d60b14
Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
...
Adding basic printing to StmtPrinter::PrintRawDecl().
llvm-svn: 44208
2007-11-17 21:21:01 +00:00
Steve Naroff
c8fcbe09d0
No need to forward declare definition of objc_super...
...
llvm-svn: 44173
2007-11-15 17:06:21 +00:00
Steve Naroff
d8ea1ac576
Implement support for variadic methods (work in progress).
...
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Steve Naroff
05caa48fb4
Extend RewriteTest::RewriteObjCIvarRefExpr() to cope with static typing (when using -> on a type which corresponds to the implementation type).
...
llvm-svn: 44170
2007-11-15 11:33:00 +00:00
Steve Naroff
44864e48bd
Tweak funky cast to accommodate messaging 'super'. This removes any spurious warnings.
...
llvm-svn: 44169
2007-11-15 10:43:57 +00:00
Steve Naroff
7fa2f040f3
Rewrite for messaging 'super'.
...
The code gen. results in some spurious warnings...a cast is forthcoming.
llvm-svn: 44168
2007-11-15 10:28:18 +00:00