blob: 35452b18e6f145953d264925e0e3c0882c71687f [file] [log] [blame]
Ted Kremenek588e5eb2007-11-25 00:58:00 +00001//===--- SemaUtil.h - Utility functions for semantic analysis -------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Ted Kremenek588e5eb2007-11-25 00:58:00 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file provides a few static inline functions that are useful for
11// performing semantic analysis.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_SEMA_UTIL_H
16#define LLVM_CLANG_SEMA_UTIL_H
17
18#include "clang/AST/Expr.h"
19
20namespace clang {
21
Ted Kremenek588e5eb2007-11-25 00:58:00 +000022/// Utility method to determine if a CallExpr is a call to a builtin.
23static inline bool isCallBuiltin(CallExpr* cexp) {
Chris Lattner56f34942008-02-13 01:02:39 +000024 Expr* sub = cexp->getCallee()->IgnoreParenCasts();
Ted Kremenek588e5eb2007-11-25 00:58:00 +000025
26 if (DeclRefExpr* E = dyn_cast<DeclRefExpr>(sub))
27 if (E->getDecl()->getIdentifier()->getBuiltinID() > 0)
28 return true;
29
30 return false;
31}
32
33} // end namespace clang
34
35#endif