summaryrefslogtreecommitdiffstats
path: root/include/clang/Sema/ScopeInfo.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-23 01:52:04 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-23 01:52:04 +0000
commit351ba91eaa6d30e523587b2d7ed676a5172c6e56 (patch)
treebab3939265bf7b3e8e922f978c9ac49701f7853e /include/clang/Sema/ScopeInfo.h
parent42461eecee98fff3671b3c14ce10f1a9e18cc95c (diff)
Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related code is reachable. This suppresses some
diagnostics that occur in unreachable code (e.g., -Warray-bound). We only pay the cost of doing the reachability analysis when we issue one of these diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/ScopeInfo.h')
-rw-r--r--include/clang/Sema/ScopeInfo.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/clang/Sema/ScopeInfo.h b/include/clang/Sema/ScopeInfo.h
index b0bb95509a..51297ae402 100644
--- a/include/clang/Sema/ScopeInfo.h
+++ b/include/clang/Sema/ScopeInfo.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_SEMA_SCOPE_INFO_H
#include "clang/AST/Type.h"
+#include "clang/Basic/PartialDiagnostic.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SetVector.h"
@@ -30,6 +31,17 @@ class SwitchStmt;
namespace sema {
+class PossiblyUnreachableDiag {
+public:
+ PartialDiagnostic PD;
+ SourceLocation Loc;
+ const Stmt *stmt;
+
+ PossiblyUnreachableDiag(const PartialDiagnostic &PD, SourceLocation Loc,
+ const Stmt *stmt)
+ : PD(PD), Loc(Loc), stmt(stmt) {}
+};
+
/// \brief Retains information about a function, method, or block that is
/// currently being parsed.
class FunctionScopeInfo {
@@ -60,6 +72,11 @@ public:
/// block, if there is any chance of applying the named return value
/// optimization.
llvm::SmallVector<ReturnStmt*, 4> Returns;
+
+ /// \brief A list of PartialDiagnostics created but delayed within the
+ /// current function scope. These diagnostics are vetted for reachability
+ /// prior to being emitted.
+ llvm::SmallVector<PossiblyUnreachableDiag, 4> PossiblyUnreachableDiags;
void setHasBranchIntoScope() {
HasBranchIntoScope = true;