Chris Lattner [Tue, 23 Jun 2009 01:20:39 +0000 (01:20 +0000)]
switch Warnings.cpp to use the diagnostics machinery to print diagnostics, not *fprintf*!
Among other things, this makes the warning about unknown warning options mappable.
For example:
Ted Kremenek [Tue, 23 Jun 2009 00:46:41 +0000 (00:46 +0000)]
MemRegions:
- Embed a reference to MemRegionManager objects in MemSpaceRegion objects
- Use this embedded reference for MemRegion objects to access ASTContext objects without external help
- Use this access to ASTContext to simplify 'isBoundable' (no ASTContext& argument required)
Ted Kremenek [Mon, 22 Jun 2009 23:13:13 +0000 (23:13 +0000)]
Refactor some of the logic in MemRegionManager for constructing regions using
member template functions and traits. The idea is to allow MemRegionManager to
construct subclasses of MemRegion that aren't declared in MemRegion.h (e.g.,
checker-specific regions).
Douglas Gregor [Mon, 22 Jun 2009 23:06:13 +0000 (23:06 +0000)]
Implement implicit instantiation of the member functions of a class template
specialization. At present, all implicit instantiations occur at the
end of the translation unit.
Douglas Gregor [Mon, 22 Jun 2009 20:57:11 +0000 (20:57 +0000)]
Rework the way we track which declarations are "used" during
compilation, and (hopefully) introduce RAII objects for changing the
"potentially evaluated" state at all of the necessary places within
Sema and Parser. Other changes:
- Set the unevaluated/potentially-evaluated context appropriately
during template instantiation.
- We now recognize three different states while parsing or
instantiating expressions: unevaluated, potentially evaluated, and
potentially potentially evaluated (for C++'s typeid).
- When we're in a potentially potentially-evaluated context, queue
up MarkDeclarationReferenced calls in a stack. For C++ typeid
expressions that are potentially evaluated, we will play back
these MarkDeclarationReferenced calls when we exit the
corresponding potentially potentially-evaluated context.
- Non-type template arguments are now parsed as constant
expressions, so they are not potentially-evaluated.
Introduce Decl::getSourceRange() which, like Stmt::getSourceRange(), represents the range that the declaration covers.
Add initial support for NamespaceDecl, VarDecl, and FunctionDecl:
-NamespaceDecl range is from name to '}'
-VarDecl is from name to possible init expression
-FunctionDecl is from name to last parameter name or to end of its function body.
Douglas Gregor [Fri, 19 Jun 2009 23:52:42 +0000 (23:52 +0000)]
Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of
function templates and member functions of class templates, which will
be implemented separately.
This commit includes support for -Wunused-parameter, printing warnings
for named parameters that are not used within a function/Objective-C
method/block. Fixes <rdar://problem/6505209>.
Ted Kremenek [Fri, 19 Jun 2009 17:10:32 +0000 (17:10 +0000)]
Remove more GetSVal/GetLValue methods in GRExprEngine/GRState, instead
preferring to use their replacements in GRState. This further unifies the code
paths for such logic and leads to some code reduction.
Zhongxing Xu [Fri, 19 Jun 2009 06:00:32 +0000 (06:00 +0000)]
A further step of r73690: associate the cast-to type with the created symbol,
because the type of the symbol is used to create the default range. We need the
sign to be consistent.
Make changes to PCHReader to allow reading a PCH file without having a pre-initialized Preprocessor.
-Introduce 'PCHReaderListener' which is an abstract interface for getting various information from the PCHReader.
-If PCHReader is constructed without a Preprocessor, it can still load the file and invoke the callbacks of PCHReaderListener.
-If PCHReader is constructed with an initialized Preprocessor, PCHValidator is used as a PCHReaderListener to validate the contents of the PCH file against the given Preprocessor.
Ted Kremenek [Thu, 18 Jun 2009 22:57:13 +0000 (22:57 +0000)]
libAnalysis:
- Remove the 'isFeasible' flag from all uses of 'Assume'.
- Remove the 'Assume' methods from GRStateManager. Now the only way to
create a new GRState with an assumption is to use the new 'assume' methods
in GRState.
Chris Lattner [Thu, 18 Jun 2009 05:55:53 +0000 (05:55 +0000)]
Fix a crash that can occur when a #pragma handler eats to the end of the
line, and when the pragma is at the end of a file. In this case, the last
token consumed could pop the lexer, invalidating CurPPLexer. Thanks to
Peter Thoman for pointing it out.
Ted Kremenek [Thu, 18 Jun 2009 01:23:53 +0000 (01:23 +0000)]
Remove more dependencies on GRStateRef. As a consequence, we can now
pretty-print a GRState object anywhere it is referenced (instead of
needing a GRStateRef of a GRStateManager handy).
Douglas Gregor [Wed, 17 Jun 2009 23:37:01 +0000 (23:37 +0000)]
Diagnose class members that shadow a template parameter. Fixes
<rdar://problem/6952203>.
To do this, we actually remove a not-quite-correct optimization in the
C++ name lookup routines. We'll revisit this optimization for the
general case once more C++ is working.
Steve Naroff [Wed, 17 Jun 2009 22:40:22 +0000 (22:40 +0000)]
First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).
This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types).
Ted Kremenek [Wed, 17 Jun 2009 22:06:03 +0000 (22:06 +0000)]
Class 'Environment' no longer should subclass llvm::FoldingSetNode.
Environment hasn't been uniqued in a FoldingSet for some time, so this
was just wasting a pointer in GRState.
Ted Kremenek [Wed, 17 Jun 2009 22:02:04 +0000 (22:02 +0000)]
Start moving in the direction of removing GRStateRef. Now each
GRState object has a direct reference to its GRStateManager, making
the functionality of GRStateRef redunandant. This will lead to some
nice API cleanup and code shrinking across libAnalysis.
Ted Kremenek [Tue, 16 Jun 2009 22:36:44 +0000 (22:36 +0000)]
RegionStoreManager:
- Add "sections" to RegionStoreManager.cpp to delineate functionality.
- Add new function "CreateFieldsOnlyRegionStoreManager" that uses the new
RegionStoreFeatures class to use a reduced set of features from
RegionStoreManager (in this case, only field-sensitivity). This isn't
completely hooked up yet.
Douglas Gregor [Tue, 16 Jun 2009 22:06:52 +0000 (22:06 +0000)]
Don't warn about -Winvalid-pch or -Wno-invalid-pch. Since we don't
search for PCH files that correspond to header inclusions, this option
does not make sense. Fixes <rdar://problem/6970322>.
Douglas Gregor [Tue, 16 Jun 2009 20:13:51 +0000 (20:13 +0000)]
Update Clang to include the InitializeAllTargets and
InitializeAllAsmPrinters LLVM headers. Also includes some minor fixes
for the CMake-based build with Xcode.
Devang Patel [Tue, 16 Jun 2009 18:02:02 +0000 (18:02 +0000)]
It is possible that main input file does not have any symbol with debug info. To handle this edge case, always create main compile unit first.
This fixes PR 4228.