clang  3.9.0
Macros | Typedefs | Functions
Sema.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtCXX.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/CXXFieldCollector.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/ExternalSemaSource.h"
#include "clang/Sema/MultiplexExternalSemaSource.h"
#include "clang/Sema/ObjCMethodList.h"
#include "clang/Sema/PrettyDeclStackTrace.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaConsumer.h"
#include "clang/Sema/TemplateDeduction.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include "clang/Basic/OpenCLExtensions.def"
Include dependency graph for Sema.cpp:

Go to the source code of this file.

Macros

#define OPENCLEXT(Ext)
 

Typedefs

typedef llvm::DenseMap< const
CXXRecordDecl *, bool
RecordCompleteMap
 

Functions

static bool ShouldRemoveFromUnused (Sema *SemaRef, const DeclaratorDecl *D)
 Used to prune the decls of Sema's UnusedFileScopedDecls vector. More...
 
static void checkUndefinedButUsed (Sema &S)
 checkUndefinedButUsed - Check for undefined objects with internal linkage or that are inline. More...
 
static bool MethodsAndNestedClassesComplete (const CXXRecordDecl *RD, RecordCompleteMap &MNCComplete)
 Returns true, if all methods and nested classes of the given CXXRecordDecl are defined in this translation unit. More...
 
static bool IsRecordFullyDefined (const CXXRecordDecl *RD, RecordCompleteMap &RecordsComplete, RecordCompleteMap &MNCComplete)
 Returns true, if the given CXXRecordDecl is fully defined in this translation unit, i.e. More...
 
static void noteOverloads (Sema &S, const UnresolvedSetImpl &Overloads, const SourceLocation FinalNoteLoc)
 Give notes for a set of overloads. More...
 
static void notePlausibleOverloads (Sema &S, SourceLocation Loc, const UnresolvedSetImpl &Overloads, bool(*IsPlausibleResult)(QualType))
 
static bool IsCallableWithAppend (Expr *E)
 Determine whether the given expression can be called by just putting parentheses after it. More...
 

Macro Definition Documentation

#define OPENCLEXT (   Ext)
Value:
if (Context.getTargetInfo().getSupportedOpenCLOpts().is_##Ext##_supported_core( \
getLangOpts().OpenCLVersion)) \
getOpenCLOptions().Ext = 1;
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:588
ASTContext * Context
OpenCLOptions & getSupportedOpenCLOpts()
Get supported OpenCL extensions and optional core features.

Typedef Documentation

typedef llvm::DenseMap<const CXXRecordDecl*, bool> RecordCompleteMap

Definition at line 556 of file Sema.cpp.

Function Documentation

static void checkUndefinedButUsed ( Sema S)
static

checkUndefinedButUsed - Check for undefined objects with internal linkage or that are inline.

Definition at line 505 of file Sema.cpp.

References clang::Sema::Diag(), E, clang::Sema::getUndefinedButUsed(), I, clang::NamedDecl::isExternallyVisible(), and clang::Sema::UndefinedButUsed.

Referenced by clang::Sema::ActOnEndOfTranslationUnit().

static bool IsCallableWithAppend ( Expr E)
static

Determine whether the given expression can be called by just putting parentheses after it.

Notably, expressions with unary operators can't be because the unary operator will start parsing outside the call.

Definition at line 1444 of file Sema.cpp.

References clang::Expr::IgnoreImplicit().

Referenced by clang::Sema::tryToRecoverWithCall().

static bool IsRecordFullyDefined ( const CXXRecordDecl RD,
RecordCompleteMap RecordsComplete,
RecordCompleteMap MNCComplete 
)
static

Returns true, if the given CXXRecordDecl is fully defined in this translation unit, i.e.

all methods are defined or pure virtual and all friends, friend functions and nested classes are fully defined in this translation unit.

Should only be called from ActOnEndOfTranslationUnit so that all definitions are actually read.

Definition at line 604 of file Sema.cpp.

References E, clang::CXXRecordDecl::friend_begin(), clang::CXXRecordDecl::friend_end(), I, and MethodsAndNestedClassesComplete().

Referenced by clang::Sema::ActOnEndOfTranslationUnit().

static bool MethodsAndNestedClassesComplete ( const CXXRecordDecl RD,
RecordCompleteMap MNCComplete 
)
static

Returns true, if all methods and nested classes of the given CXXRecordDecl are defined in this translation unit.

Should only be called from ActOnEndOfTranslationUnit so that all definitions are actually read.

Definition at line 563 of file Sema.cpp.

References clang::DeclContext::decls_begin(), clang::DeclContext::decls_end(), E, I, clang::if(), and clang::TagDecl::isCompleteDefinition().

Referenced by IsRecordFullyDefined().

static void noteOverloads ( Sema S,
const UnresolvedSetImpl Overloads,
const SourceLocation  FinalNoteLoc 
)
static

Give notes for a set of overloads.

A companion to tryExprAsCall. In cases when the name that the programmer wrote was an overloaded function, we may be able to make some guesses about plausible overloads based on their return types; such guesses can be handed off to this method to be emitted as notes.

Parameters
Overloads- The overloads to note.
FinalNoteLoc- If we've suppressed printing some overloads due to -fshow-overloads=best, this is the location to attach to the note about too many candidates. Typically this will be the location of the original ill-formed expression.

Definition at line 1400 of file Sema.cpp.

References clang::UnresolvedSetImpl::begin(), clang::Sema::Diag(), clang::Sema::Diags, clang::UnresolvedSetImpl::end(), clang::DiagnosticsEngine::getShowOverloads(), clang::NamedDecl::getUnderlyingDecl(), and clang::Ovl_Best.

Referenced by notePlausibleOverloads().

static void notePlausibleOverloads ( Sema S,
SourceLocation  Loc,
const UnresolvedSetImpl Overloads,
bool(*)(QualType IsPlausibleResult 
)
static
static bool ShouldRemoveFromUnused ( Sema SemaRef,
const DeclaratorDecl D 
)
static