Update clang to r108243.
This commit is contained in:
parent
53992adde3
commit
1928da94b5
@ -1,10 +1,5 @@
|
||||
# Clang version information
|
||||
|
||||
# Make sure that CMake reconfigures when the version changes.
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/VER
|
||||
${CMAKE_CURRENT_BINARY_DIR}/VER)
|
||||
|
||||
set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
@ -28,12 +23,28 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Compute the Clang version from the contents of VER
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VER CLANG_VERSION_DATA)
|
||||
# Compute the Clang version from the LLVM version.
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
|
||||
${CLANG_VERSION_DATA})
|
||||
${PACKAGE_VERSION})
|
||||
message(STATUS "Clang version: ${CLANG_VERSION}")
|
||||
|
||||
string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" CLANG_VERSION_MAJOR
|
||||
${CLANG_VERSION})
|
||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" CLANG_VERSION_MINOR
|
||||
${CLANG_VERSION})
|
||||
if (${CLANG_VERSION} MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
|
||||
set(CLANG_HAS_VERSION_PATCHLEVEL 1)
|
||||
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" CLANG_VERSION_PATCHLEVEL
|
||||
${CLANG_VERSION})
|
||||
else()
|
||||
set(CLANG_HAS_VERSION_PATCHLEVEL 0)
|
||||
endif()
|
||||
|
||||
# Configure the Version.inc file.
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/clang/Basic/Version.inc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/clang/Basic/Version.inc)
|
||||
|
||||
# Add appropriate flags for GCC
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# FIXME: Turn off exceptions, RTTI:
|
||||
@ -41,6 +52,10 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
|
||||
endif ()
|
||||
|
||||
macro(add_clang_library name)
|
||||
set(srcs ${ARGN})
|
||||
if(MSVC_IDE OR XCODE)
|
||||
@ -54,7 +69,9 @@ macro(add_clang_library name)
|
||||
../../include/clang${dir}/*.def)
|
||||
set(srcs ${srcs} ${headers})
|
||||
endif(MSVC_IDE OR XCODE)
|
||||
if (SHARED_LIBRARY)
|
||||
if (MODULE)
|
||||
set(libkind MODULE)
|
||||
elseif (SHARED_LIBRARY)
|
||||
set(libkind SHARED)
|
||||
else()
|
||||
set(libkind)
|
||||
|
57
Makefile
57
Makefile
@ -1,14 +1,63 @@
|
||||
LEVEL = ../..
|
||||
DIRS := include lib tools docs
|
||||
##===- Makefile --------------------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
# If CLANG_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
|
||||
# are being included from a subdirectory makefile.
|
||||
|
||||
ifndef CLANG_LEVEL
|
||||
|
||||
IS_TOP_LEVEL := 1
|
||||
CLANG_LEVEL := .
|
||||
DIRS := include lib tools runtime docs
|
||||
|
||||
PARALLEL_DIRS :=
|
||||
|
||||
ifeq ($(BUILD_EXAMPLES),1)
|
||||
PARALLEL_DIRS += examples
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),libs-only)
|
||||
DIRS := $(filter-out tools docs, $(DIRS))
|
||||
OPTIONAL_DIRS :=
|
||||
endif
|
||||
|
||||
###
|
||||
# Common Makefile code, shared by all Clang Makefiles.
|
||||
|
||||
# Set LLVM source root level.
|
||||
LEVEL := $(CLANG_LEVEL)/../..
|
||||
|
||||
# Include LLVM common makefile.
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
# Set common Clang build flags.
|
||||
CPP.Flags += -I$(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -I$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include
|
||||
ifdef CLANG_VENDOR
|
||||
CPP.Flags += -DCLANG_VENDOR='"$(CLANG_VENDOR) "'
|
||||
endif
|
||||
|
||||
# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
|
||||
# work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
|
||||
# GCC's have false positive warnings with it on Linux (which prove a pain to
|
||||
# fix). For example:
|
||||
# http://gcc.gnu.org/PR41874
|
||||
# http://gcc.gnu.org/PR41838
|
||||
#
|
||||
# We can revisit this when LLVM/Clang support it.
|
||||
CXX.Flags += -fno-strict-aliasing
|
||||
|
||||
###
|
||||
# Clang Top Level specific stuff.
|
||||
|
||||
ifeq ($(IS_TOP_LEVEL),1)
|
||||
|
||||
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
|
||||
$(RecursiveTargets)::
|
||||
$(Verb) if [ ! -f test/Makefile ]; then \
|
||||
@ -26,6 +75,8 @@ report::
|
||||
clean::
|
||||
@ $(MAKE) -C test clean
|
||||
|
||||
libs-only: all
|
||||
|
||||
tags::
|
||||
$(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
|
||||
grep -v /lib/Headers | grep -v /test/`
|
||||
@ -37,3 +88,5 @@ cscope.files:
|
||||
-or -name '*.h' > cscope.files
|
||||
|
||||
.PHONY: test report clean cscope.files
|
||||
|
||||
endif
|
||||
|
@ -13,8 +13,7 @@ This is similar to -Eonly.
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
Creating and using a PTH file for performance measurement (use a release-asserts
|
||||
build).
|
||||
Creating and using a PTH file for performance measurement (use a release build).
|
||||
|
||||
$ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
|
||||
$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
Welcome to Clang. This is a compiler front-end for the C family of languages
|
||||
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
|
||||
compiler intrastructure project.
|
||||
compiler infrastructure project.
|
||||
|
||||
Unlike many other compiler frontends, Clang is useful for a number of things
|
||||
beyond just compiling code: we intend for Clang to be host to a number of
|
||||
|
@ -19,9 +19,6 @@
|
||||
1A2A54BD0FD1DD1C00F4CE45 /* HTMLPrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AC0FD1DD1C00F4CE45 /* HTMLPrint.cpp */; };
|
||||
1A2A54BE0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AD0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp */; };
|
||||
1A2A54BF0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54AE0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp */; };
|
||||
1A2A54C10FD1DD1C00F4CE45 /* RewriteMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */; };
|
||||
1A2A54C20FD1DD1C00F4CE45 /* RewriteObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */; };
|
||||
1A2A54C30FD1DD1C00F4CE45 /* RewriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */; };
|
||||
1A2A54C40FD1DD1C00F4CE45 /* StmtXML.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */; };
|
||||
1A2A54C50FD1DD1C00F4CE45 /* Warnings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */; };
|
||||
1A30A9E90B93A4C800201A91 /* ExprCXX.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1A30A9E80B93A4C800201A91 /* ExprCXX.h */; };
|
||||
@ -171,6 +168,50 @@
|
||||
BF89C3F911595A01001C2D68 /* SemaType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3F811595A01001C2D68 /* SemaType.cpp */; };
|
||||
BF89C3FB11595A37001C2D68 /* SemaCodeComplete.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3FA11595A37001C2D68 /* SemaCodeComplete.cpp */; };
|
||||
BF89C3FD11595A5D001C2D68 /* SemaExceptionSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF89C3FC11595A5D001C2D68 /* SemaExceptionSpec.cpp */; };
|
||||
BFE2F6AB11DA955A0007EDC0 /* DeltaTree.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F67D11DA95590007EDC0 /* DeltaTree.d */; };
|
||||
BFE2F6AC11DA955A0007EDC0 /* DeltaTree.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */; };
|
||||
BFE2F6AD11DA955A0007EDC0 /* FixItRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */; };
|
||||
BFE2F6AE11DA955A0007EDC0 /* FixItRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */; };
|
||||
BFE2F6AF11DA955A0007EDC0 /* FrontendActions.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68111DA955A0007EDC0 /* FrontendActions.d */; };
|
||||
BFE2F6B011DA955A0007EDC0 /* FrontendActions.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68211DA955A0007EDC0 /* FrontendActions.o */; };
|
||||
BFE2F6B111DA955A0007EDC0 /* HTMLPrint.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */; };
|
||||
BFE2F6B211DA955A0007EDC0 /* HTMLPrint.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */; };
|
||||
BFE2F6B311DA955A0007EDC0 /* HTMLRewrite.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */; };
|
||||
BFE2F6B411DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */; };
|
||||
BFE2F6B511DA955A0007EDC0 /* RewriteMacros.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */; };
|
||||
BFE2F6B611DA955A0007EDC0 /* RewriteMacros.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */; };
|
||||
BFE2F6B711DA955A0007EDC0 /* RewriteObjC.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */; };
|
||||
BFE2F6B811DA955A0007EDC0 /* RewriteObjC.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */; };
|
||||
BFE2F6B911DA955A0007EDC0 /* Rewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68B11DA955A0007EDC0 /* Rewriter.d */; };
|
||||
BFE2F6BA11DA955A0007EDC0 /* Rewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68C11DA955A0007EDC0 /* Rewriter.o */; };
|
||||
BFE2F6BB11DA955A0007EDC0 /* RewriteRope.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */; };
|
||||
BFE2F6BC11DA955A0007EDC0 /* RewriteRope.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */; };
|
||||
BFE2F6BD11DA955A0007EDC0 /* RewriteTest.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */; };
|
||||
BFE2F6BE11DA955A0007EDC0 /* RewriteTest.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69011DA955A0007EDC0 /* RewriteTest.o */; };
|
||||
BFE2F6BF11DA955A0007EDC0 /* TokenRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */; };
|
||||
BFE2F6C011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */; };
|
||||
BFE2F6C111DA955A0007EDC0 /* DeltaTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */; };
|
||||
BFE2F6C211DA955A0007EDC0 /* FixItRewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */; };
|
||||
BFE2F6C311DA955A0007EDC0 /* FrontendActions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */; };
|
||||
BFE2F6C411DA955A0007EDC0 /* HTMLPrint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */; };
|
||||
BFE2F6C511DA955A0007EDC0 /* HTMLRewrite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */; };
|
||||
BFE2F6C611DA955A0007EDC0 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69811DA955A0007EDC0 /* Makefile */; };
|
||||
BFE2F6C711DA955A0007EDC0 /* DeltaTree.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */; };
|
||||
BFE2F6C811DA955A0007EDC0 /* DeltaTree.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */; };
|
||||
BFE2F6C911DA955A0007EDC0 /* HTMLRewrite.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */; };
|
||||
BFE2F6CA11DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */; };
|
||||
BFE2F6CB11DA955A0007EDC0 /* Rewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F69F11DA955A0007EDC0 /* Rewriter.d */; };
|
||||
BFE2F6CC11DA955A0007EDC0 /* Rewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A011DA955A0007EDC0 /* Rewriter.o */; };
|
||||
BFE2F6CD11DA955A0007EDC0 /* RewriteRope.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */; };
|
||||
BFE2F6CE11DA955A0007EDC0 /* RewriteRope.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */; };
|
||||
BFE2F6CF11DA955A0007EDC0 /* TokenRewriter.d in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */; };
|
||||
BFE2F6D011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */; };
|
||||
BFE2F6D111DA955A0007EDC0 /* RewriteMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */; };
|
||||
BFE2F6D211DA955A0007EDC0 /* RewriteObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */; };
|
||||
BFE2F6D311DA955A0007EDC0 /* Rewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */; };
|
||||
BFE2F6D411DA955A0007EDC0 /* RewriteRope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */; };
|
||||
BFE2F6D511DA955A0007EDC0 /* RewriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */; };
|
||||
BFE2F6D611DA955A0007EDC0 /* TokenRewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */; };
|
||||
DE01DA490B12ADA300AC22CE /* PPCallbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE01DA480B12ADA300AC22CE /* PPCallbacks.h */; };
|
||||
DE06756C0C051CFE00EBBFD8 /* ParseExprCXX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */; };
|
||||
DE06B73E0A8307640050E87E /* LangOptions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE06B73D0A8307640050E87E /* LangOptions.h */; };
|
||||
@ -391,9 +432,6 @@
|
||||
1A2A54AC0FD1DD1C00F4CE45 /* HTMLPrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HTMLPrint.cpp; path = lib/Frontend/HTMLPrint.cpp; sourceTree = "<group>"; };
|
||||
1A2A54AD0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PrintParserCallbacks.cpp; path = lib/Frontend/PrintParserCallbacks.cpp; sourceTree = "<group>"; };
|
||||
1A2A54AE0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PrintPreprocessedOutput.cpp; path = lib/Frontend/PrintPreprocessedOutput.cpp; sourceTree = "<group>"; };
|
||||
1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteMacros.cpp; path = lib/Frontend/RewriteMacros.cpp; sourceTree = "<group>"; };
|
||||
1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteObjC.cpp; path = lib/Frontend/RewriteObjC.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RewriteTest.cpp; path = lib/Frontend/RewriteTest.cpp; sourceTree = "<group>"; };
|
||||
1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StmtXML.cpp; path = lib/Frontend/StmtXML.cpp; sourceTree = "<group>"; };
|
||||
1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Warnings.cpp; path = lib/Frontend/Warnings.cpp; sourceTree = "<group>"; };
|
||||
1A30A9E80B93A4C800201A91 /* ExprCXX.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = ExprCXX.h; path = clang/AST/ExprCXX.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
@ -438,6 +476,10 @@
|
||||
1A869AA70BA21ABA008DA07A /* LiteralSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralSupport.cpp; sourceTree = "<group>"; };
|
||||
1A97825A1108BA18002B98FC /* CGVTT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGVTT.cpp; path = lib/CodeGen/CGVTT.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A986AB610D0746D00A8EA9E /* CGDeclCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGDeclCXX.cpp; path = lib/CodeGen/CGDeclCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1AA1D35611BECFF70089CC3F /* CC1AsOptions.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CC1AsOptions.td; path = clang/Driver/CC1AsOptions.td; sourceTree = "<group>"; };
|
||||
1AA1D35711BECFF70089CC3F /* CC1Options.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CC1Options.td; path = clang/Driver/CC1Options.td; sourceTree = "<group>"; };
|
||||
1AA1D35811BECFF70089CC3F /* Options.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Options.td; path = clang/Driver/Options.td; sourceTree = "<group>"; };
|
||||
1AA1D35911BECFF70089CC3F /* OptParser.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OptParser.td; path = clang/Driver/OptParser.td; sourceTree = "<group>"; };
|
||||
1AA963AB10D8576800786C86 /* FullExpr.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = FullExpr.h; path = clang/AST/FullExpr.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1AB290021045858B00FE33D8 /* PartialDiagnostic.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = PartialDiagnostic.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1ABC36930C7A4BDC006DB0AB /* CGBuiltin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGBuiltin.cpp; path = lib/CodeGen/CGBuiltin.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
@ -661,6 +703,53 @@
|
||||
BF89C3F811595A01001C2D68 /* SemaType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaType.cpp; path = lib/Sema/SemaType.cpp; sourceTree = "<group>"; };
|
||||
BF89C3FA11595A37001C2D68 /* SemaCodeComplete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaCodeComplete.cpp; path = lib/Sema/SemaCodeComplete.cpp; sourceTree = "<group>"; };
|
||||
BF89C3FC11595A5D001C2D68 /* SemaExceptionSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SemaExceptionSpec.cpp; path = lib/Sema/SemaExceptionSpec.cpp; sourceTree = "<group>"; };
|
||||
BFE2F67A11DA95590007EDC0 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
|
||||
BFE2F67C11DA95590007EDC0 /* .dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .dir; sourceTree = "<group>"; };
|
||||
BFE2F67D11DA95590007EDC0 /* DeltaTree.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = DeltaTree.d; sourceTree = "<group>"; };
|
||||
BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = DeltaTree.o; sourceTree = "<group>"; };
|
||||
BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = FixItRewriter.d; sourceTree = "<group>"; };
|
||||
BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = FixItRewriter.o; sourceTree = "<group>"; };
|
||||
BFE2F68111DA955A0007EDC0 /* FrontendActions.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = FrontendActions.d; sourceTree = "<group>"; };
|
||||
BFE2F68211DA955A0007EDC0 /* FrontendActions.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = FrontendActions.o; sourceTree = "<group>"; };
|
||||
BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLPrint.d; sourceTree = "<group>"; };
|
||||
BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLPrint.o; sourceTree = "<group>"; };
|
||||
BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLRewrite.d; sourceTree = "<group>"; };
|
||||
BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLRewrite.o; sourceTree = "<group>"; };
|
||||
BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteMacros.d; sourceTree = "<group>"; };
|
||||
BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteMacros.o; sourceTree = "<group>"; };
|
||||
BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteObjC.d; sourceTree = "<group>"; };
|
||||
BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteObjC.o; sourceTree = "<group>"; };
|
||||
BFE2F68B11DA955A0007EDC0 /* Rewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = Rewriter.d; sourceTree = "<group>"; };
|
||||
BFE2F68C11DA955A0007EDC0 /* Rewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = Rewriter.o; sourceTree = "<group>"; };
|
||||
BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteRope.d; sourceTree = "<group>"; };
|
||||
BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteRope.o; sourceTree = "<group>"; };
|
||||
BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteTest.d; sourceTree = "<group>"; };
|
||||
BFE2F69011DA955A0007EDC0 /* RewriteTest.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteTest.o; sourceTree = "<group>"; };
|
||||
BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = TokenRewriter.d; sourceTree = "<group>"; };
|
||||
BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TokenRewriter.o; sourceTree = "<group>"; };
|
||||
BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeltaTree.cpp; sourceTree = "<group>"; };
|
||||
BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FixItRewriter.cpp; sourceTree = "<group>"; };
|
||||
BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrontendActions.cpp; sourceTree = "<group>"; };
|
||||
BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPrint.cpp; sourceTree = "<group>"; };
|
||||
BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLRewrite.cpp; sourceTree = "<group>"; };
|
||||
BFE2F69811DA955A0007EDC0 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
BFE2F69A11DA955A0007EDC0 /* .dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .dir; sourceTree = "<group>"; };
|
||||
BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = DeltaTree.d; sourceTree = "<group>"; };
|
||||
BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = DeltaTree.o; sourceTree = "<group>"; };
|
||||
BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HTMLRewrite.d; sourceTree = "<group>"; };
|
||||
BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = HTMLRewrite.o; sourceTree = "<group>"; };
|
||||
BFE2F69F11DA955A0007EDC0 /* Rewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = Rewriter.d; sourceTree = "<group>"; };
|
||||
BFE2F6A011DA955A0007EDC0 /* Rewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = Rewriter.o; sourceTree = "<group>"; };
|
||||
BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = RewriteRope.d; sourceTree = "<group>"; };
|
||||
BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = RewriteRope.o; sourceTree = "<group>"; };
|
||||
BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = TokenRewriter.d; sourceTree = "<group>"; };
|
||||
BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = TokenRewriter.o; sourceTree = "<group>"; };
|
||||
BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteMacros.cpp; sourceTree = "<group>"; };
|
||||
BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteObjC.cpp; sourceTree = "<group>"; };
|
||||
BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Rewriter.cpp; sourceTree = "<group>"; };
|
||||
BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteRope.cpp; sourceTree = "<group>"; };
|
||||
BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteTest.cpp; sourceTree = "<group>"; };
|
||||
BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenRewriter.cpp; sourceTree = "<group>"; };
|
||||
DE01DA480B12ADA300AC22CE /* PPCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCallbacks.h; sourceTree = "<group>"; };
|
||||
DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ParseExprCXX.cpp; path = lib/Parse/ParseExprCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 2; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
@ -807,24 +896,24 @@
|
||||
DEDFE5270F63A9230035BD10 /* DeclNodes.def */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; name = DeclNodes.def; path = clang/AST/DeclNodes.def; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE5CB0F7206CC0035BD10 /* NestedNameSpecifier.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = NestedNameSpecifier.h; path = clang/AST/NestedNameSpecifier.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6450F7B3B4E0035BD10 /* driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = driver.cpp; path = tools/driver/driver.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6480F7B3B830035BD10 /* Types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Types.cpp; path = lib/Driver/Types.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6490F7B3B830035BD10 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = lib/Driver/Tools.h; sourceTree = "<group>"; };
|
||||
DEDFE64A0F7B3B830035BD10 /* Tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tools.cpp; path = lib/Driver/Tools.cpp; sourceTree = "<group>"; };
|
||||
DEDFE64B0F7B3B830035BD10 /* ToolChains.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToolChains.h; path = lib/Driver/ToolChains.h; sourceTree = "<group>"; };
|
||||
DEDFE64C0F7B3B830035BD10 /* Compilation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Compilation.cpp; path = lib/Driver/Compilation.cpp; sourceTree = "<group>"; };
|
||||
DEDFE64D0F7B3B830035BD10 /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArgList.cpp; path = lib/Driver/ArgList.cpp; sourceTree = "<group>"; };
|
||||
DEDFE64E0F7B3B830035BD10 /* Arg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Arg.cpp; path = lib/Driver/Arg.cpp; sourceTree = "<group>"; };
|
||||
DEDFE64F0F7B3B830035BD10 /* Action.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Action.cpp; path = lib/Driver/Action.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6500F7B3B830035BD10 /* Phases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Phases.cpp; path = lib/Driver/Phases.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6510F7B3B830035BD10 /* OptTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptTable.cpp; path = lib/Driver/OptTable.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6520F7B3B830035BD10 /* Option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = lib/Driver/Option.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6530F7B3B830035BD10 /* Job.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Job.cpp; path = lib/Driver/Job.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6540F7B3B830035BD10 /* InputInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputInfo.h; path = lib/Driver/InputInfo.h; sourceTree = "<group>"; };
|
||||
DEDFE6550F7B3B830035BD10 /* ToolChains.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChains.cpp; path = lib/Driver/ToolChains.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6560F7B3B830035BD10 /* ToolChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChain.cpp; path = lib/Driver/ToolChain.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6570F7B3B830035BD10 /* Tool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tool.cpp; path = lib/Driver/Tool.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6580F7B3B830035BD10 /* HostInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HostInfo.cpp; path = lib/Driver/HostInfo.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6590F7B3B830035BD10 /* Driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Driver.cpp; path = lib/Driver/Driver.cpp; sourceTree = "<group>"; };
|
||||
DEDFE6480F7B3B830035BD10 /* Types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Types.cpp; path = lib/Driver/Types.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6490F7B3B830035BD10 /* Tools.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = lib/Driver/Tools.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64A0F7B3B830035BD10 /* Tools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Tools.cpp; path = lib/Driver/Tools.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64B0F7B3B830035BD10 /* ToolChains.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = ToolChains.h; path = lib/Driver/ToolChains.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64C0F7B3B830035BD10 /* Compilation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Compilation.cpp; path = lib/Driver/Compilation.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64D0F7B3B830035BD10 /* ArgList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ArgList.cpp; path = lib/Driver/ArgList.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64E0F7B3B830035BD10 /* Arg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Arg.cpp; path = lib/Driver/Arg.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE64F0F7B3B830035BD10 /* Action.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Action.cpp; path = lib/Driver/Action.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6500F7B3B830035BD10 /* Phases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Phases.cpp; path = lib/Driver/Phases.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6510F7B3B830035BD10 /* OptTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = OptTable.cpp; path = lib/Driver/OptTable.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6520F7B3B830035BD10 /* Option.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = lib/Driver/Option.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6530F7B3B830035BD10 /* Job.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Job.cpp; path = lib/Driver/Job.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6540F7B3B830035BD10 /* InputInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = InputInfo.h; path = lib/Driver/InputInfo.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6550F7B3B830035BD10 /* ToolChains.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChains.cpp; path = lib/Driver/ToolChains.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6560F7B3B830035BD10 /* ToolChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ToolChain.cpp; path = lib/Driver/ToolChain.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6570F7B3B830035BD10 /* Tool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Tool.cpp; path = lib/Driver/Tool.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6580F7B3B830035BD10 /* HostInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = HostInfo.cpp; path = lib/Driver/HostInfo.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFE6590F7B3B830035BD10 /* Driver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = Driver.cpp; path = lib/Driver/Driver.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFF87F0F848CE30035BD10 /* TemplateName.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = TemplateName.h; path = clang/AST/TemplateName.h; sourceTree = "<group>"; tabWidth = 2; };
|
||||
DEDFFF070F959EE60035BD10 /* Diagnostic.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Diagnostic.td; sourceTree = "<group>"; };
|
||||
DEDFFF530F9704580035BD10 /* DiagnosticGroups.td */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DiagnosticGroups.td; sourceTree = "<group>"; };
|
||||
@ -841,7 +930,6 @@
|
||||
DEF165150F8D46980098507F /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Types.h; path = clang/Driver/Types.h; sourceTree = "<group>"; };
|
||||
DEF165160F8D46980098507F /* Action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Action.h; path = clang/Driver/Action.h; sourceTree = "<group>"; };
|
||||
DEF165170F8D46980098507F /* Compilation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Compilation.h; path = clang/Driver/Compilation.h; sourceTree = "<group>"; };
|
||||
DEF165180F8D46980098507F /* Options.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Options.def; path = clang/Driver/Options.def; sourceTree = "<group>"; };
|
||||
DEF165190F8D46980098507F /* Option.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Option.h; path = clang/Driver/Option.h; sourceTree = "<group>"; };
|
||||
DEF1651A0F8D46980098507F /* Types.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Types.def; path = clang/Driver/Types.def; sourceTree = "<group>"; };
|
||||
DEF1651B0F8D46980098507F /* ToolChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToolChain.h; path = clang/Driver/ToolChain.h; sourceTree = "<group>"; };
|
||||
@ -880,6 +968,22 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BFE2F6AC11DA955A0007EDC0 /* DeltaTree.o in Frameworks */,
|
||||
BFE2F6AE11DA955A0007EDC0 /* FixItRewriter.o in Frameworks */,
|
||||
BFE2F6B011DA955A0007EDC0 /* FrontendActions.o in Frameworks */,
|
||||
BFE2F6B211DA955A0007EDC0 /* HTMLPrint.o in Frameworks */,
|
||||
BFE2F6B411DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */,
|
||||
BFE2F6B611DA955A0007EDC0 /* RewriteMacros.o in Frameworks */,
|
||||
BFE2F6B811DA955A0007EDC0 /* RewriteObjC.o in Frameworks */,
|
||||
BFE2F6BA11DA955A0007EDC0 /* Rewriter.o in Frameworks */,
|
||||
BFE2F6BC11DA955A0007EDC0 /* RewriteRope.o in Frameworks */,
|
||||
BFE2F6BE11DA955A0007EDC0 /* RewriteTest.o in Frameworks */,
|
||||
BFE2F6C011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */,
|
||||
BFE2F6C811DA955A0007EDC0 /* DeltaTree.o in Frameworks */,
|
||||
BFE2F6CA11DA955A0007EDC0 /* HTMLRewrite.o in Frameworks */,
|
||||
BFE2F6CC11DA955A0007EDC0 /* Rewriter.o in Frameworks */,
|
||||
BFE2F6CE11DA955A0007EDC0 /* RewriteRope.o in Frameworks */,
|
||||
BFE2F6D011DA955A0007EDC0 /* TokenRewriter.o in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -901,6 +1005,7 @@
|
||||
08FB7795FE84155DC02AAC07 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFE2F67911DA95590007EDC0 /* Rewrite */,
|
||||
90FD6D6C103C3D2D005F5B73 /* Index */,
|
||||
DED7D7500A5242C7003AD0FB /* Basic */,
|
||||
DED7D78C0A5242E6003AD0FB /* Lex */,
|
||||
@ -1012,9 +1117,6 @@
|
||||
352246E50F5C6BE000D0D279 /* TextDiagnosticBuffer.cpp */,
|
||||
352246E60F5C6BE000D0D279 /* TextDiagnosticPrinter.cpp */,
|
||||
1ACB57E21105820D0047B991 /* TypeXML.cpp */,
|
||||
1A2A54B00FD1DD1C00F4CE45 /* RewriteMacros.cpp */,
|
||||
1A2A54B10FD1DD1C00F4CE45 /* RewriteObjC.cpp */,
|
||||
1A2A54B20FD1DD1C00F4CE45 /* RewriteTest.cpp */,
|
||||
1A2A54B30FD1DD1C00F4CE45 /* StmtXML.cpp */,
|
||||
1ACB57E31105820D0047B991 /* VerifyDiagnosticsClient.cpp */,
|
||||
1A2A54B40FD1DD1C00F4CE45 /* Warnings.cpp */,
|
||||
@ -1209,6 +1311,77 @@
|
||||
name = "index-test";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFE2F67911DA95590007EDC0 /* Rewrite */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFE2F67A11DA95590007EDC0 /* CMakeLists.txt */,
|
||||
BFE2F67B11DA95590007EDC0 /* Debug */,
|
||||
BFE2F69311DA955A0007EDC0 /* DeltaTree.cpp */,
|
||||
BFE2F69411DA955A0007EDC0 /* FixItRewriter.cpp */,
|
||||
BFE2F69511DA955A0007EDC0 /* FrontendActions.cpp */,
|
||||
BFE2F69611DA955A0007EDC0 /* HTMLPrint.cpp */,
|
||||
BFE2F69711DA955A0007EDC0 /* HTMLRewrite.cpp */,
|
||||
BFE2F69811DA955A0007EDC0 /* Makefile */,
|
||||
BFE2F69911DA955A0007EDC0 /* Release-Asserts */,
|
||||
BFE2F6A511DA955A0007EDC0 /* RewriteMacros.cpp */,
|
||||
BFE2F6A611DA955A0007EDC0 /* RewriteObjC.cpp */,
|
||||
BFE2F6A711DA955A0007EDC0 /* Rewriter.cpp */,
|
||||
BFE2F6A811DA955A0007EDC0 /* RewriteRope.cpp */,
|
||||
BFE2F6A911DA955A0007EDC0 /* RewriteTest.cpp */,
|
||||
BFE2F6AA11DA955A0007EDC0 /* TokenRewriter.cpp */,
|
||||
);
|
||||
name = Rewrite;
|
||||
path = lib/Rewrite;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFE2F67B11DA95590007EDC0 /* Debug */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFE2F67C11DA95590007EDC0 /* .dir */,
|
||||
BFE2F67D11DA95590007EDC0 /* DeltaTree.d */,
|
||||
BFE2F67E11DA955A0007EDC0 /* DeltaTree.o */,
|
||||
BFE2F67F11DA955A0007EDC0 /* FixItRewriter.d */,
|
||||
BFE2F68011DA955A0007EDC0 /* FixItRewriter.o */,
|
||||
BFE2F68111DA955A0007EDC0 /* FrontendActions.d */,
|
||||
BFE2F68211DA955A0007EDC0 /* FrontendActions.o */,
|
||||
BFE2F68311DA955A0007EDC0 /* HTMLPrint.d */,
|
||||
BFE2F68411DA955A0007EDC0 /* HTMLPrint.o */,
|
||||
BFE2F68511DA955A0007EDC0 /* HTMLRewrite.d */,
|
||||
BFE2F68611DA955A0007EDC0 /* HTMLRewrite.o */,
|
||||
BFE2F68711DA955A0007EDC0 /* RewriteMacros.d */,
|
||||
BFE2F68811DA955A0007EDC0 /* RewriteMacros.o */,
|
||||
BFE2F68911DA955A0007EDC0 /* RewriteObjC.d */,
|
||||
BFE2F68A11DA955A0007EDC0 /* RewriteObjC.o */,
|
||||
BFE2F68B11DA955A0007EDC0 /* Rewriter.d */,
|
||||
BFE2F68C11DA955A0007EDC0 /* Rewriter.o */,
|
||||
BFE2F68D11DA955A0007EDC0 /* RewriteRope.d */,
|
||||
BFE2F68E11DA955A0007EDC0 /* RewriteRope.o */,
|
||||
BFE2F68F11DA955A0007EDC0 /* RewriteTest.d */,
|
||||
BFE2F69011DA955A0007EDC0 /* RewriteTest.o */,
|
||||
BFE2F69111DA955A0007EDC0 /* TokenRewriter.d */,
|
||||
BFE2F69211DA955A0007EDC0 /* TokenRewriter.o */,
|
||||
);
|
||||
path = Debug;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFE2F69911DA955A0007EDC0 /* Release-Asserts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFE2F69A11DA955A0007EDC0 /* .dir */,
|
||||
BFE2F69B11DA955A0007EDC0 /* DeltaTree.d */,
|
||||
BFE2F69C11DA955A0007EDC0 /* DeltaTree.o */,
|
||||
BFE2F69D11DA955A0007EDC0 /* HTMLRewrite.d */,
|
||||
BFE2F69E11DA955A0007EDC0 /* HTMLRewrite.o */,
|
||||
BFE2F69F11DA955A0007EDC0 /* Rewriter.d */,
|
||||
BFE2F6A011DA955A0007EDC0 /* Rewriter.o */,
|
||||
BFE2F6A111DA955A0007EDC0 /* RewriteRope.d */,
|
||||
BFE2F6A211DA955A0007EDC0 /* RewriteRope.o */,
|
||||
BFE2F6A311DA955A0007EDC0 /* TokenRewriter.d */,
|
||||
BFE2F6A411DA955A0007EDC0 /* TokenRewriter.o */,
|
||||
);
|
||||
path = "Release-Asserts";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C6859E8C029090F304C91782 /* Documentation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1722,14 +1895,17 @@
|
||||
DEF165160F8D46980098507F /* Action.h */,
|
||||
DEF1651D0F8D46980098507F /* ArgList.h */,
|
||||
DEF1651E0F8D46980098507F /* Arg.h */,
|
||||
1AA1D35611BECFF70089CC3F /* CC1AsOptions.td */,
|
||||
1AA1D35711BECFF70089CC3F /* CC1Options.td */,
|
||||
DEF165170F8D46980098507F /* Compilation.h */,
|
||||
DEF165240F8D46980098507F /* DriverDiagnostic.h */,
|
||||
DEF165200F8D46980098507F /* Driver.h */,
|
||||
DEF1651F0F8D46980098507F /* HostInfo.h */,
|
||||
DEF165210F8D46980098507F /* Job.h */,
|
||||
DEF165180F8D46980098507F /* Options.def */,
|
||||
DEF165190F8D46980098507F /* Option.h */,
|
||||
1AA1D35811BECFF70089CC3F /* Options.td */,
|
||||
DEF1651C0F8D46980098507F /* Options.h */,
|
||||
1AA1D35911BECFF70089CC3F /* OptParser.td */,
|
||||
DEF165230F8D46980098507F /* Phases.h */,
|
||||
DEF165140F8D46980098507F /* Tool.h */,
|
||||
DEF165150F8D46980098507F /* Types.h */,
|
||||
@ -1966,9 +2142,6 @@
|
||||
1A2A54BD0FD1DD1C00F4CE45 /* HTMLPrint.cpp in Sources */,
|
||||
1A2A54BE0FD1DD1C00F4CE45 /* PrintParserCallbacks.cpp in Sources */,
|
||||
1A2A54BF0FD1DD1C00F4CE45 /* PrintPreprocessedOutput.cpp in Sources */,
|
||||
1A2A54C10FD1DD1C00F4CE45 /* RewriteMacros.cpp in Sources */,
|
||||
1A2A54C20FD1DD1C00F4CE45 /* RewriteObjC.cpp in Sources */,
|
||||
1A2A54C30FD1DD1C00F4CE45 /* RewriteTest.cpp in Sources */,
|
||||
1A2A54C40FD1DD1C00F4CE45 /* StmtXML.cpp in Sources */,
|
||||
1A2A54C50FD1DD1C00F4CE45 /* Warnings.cpp in Sources */,
|
||||
1A6FE7090FD6F85800E00CA9 /* CGTemporaries.cpp in Sources */,
|
||||
@ -2058,6 +2231,34 @@
|
||||
1ABD23F71182449800A48E65 /* Type.cpp in Sources */,
|
||||
1ABD23F81182449800A48E65 /* TypeLoc.cpp in Sources */,
|
||||
1ABD23F91182449800A48E65 /* TypePrinter.cpp in Sources */,
|
||||
BFE2F6AB11DA955A0007EDC0 /* DeltaTree.d in Sources */,
|
||||
BFE2F6AD11DA955A0007EDC0 /* FixItRewriter.d in Sources */,
|
||||
BFE2F6AF11DA955A0007EDC0 /* FrontendActions.d in Sources */,
|
||||
BFE2F6B111DA955A0007EDC0 /* HTMLPrint.d in Sources */,
|
||||
BFE2F6B311DA955A0007EDC0 /* HTMLRewrite.d in Sources */,
|
||||
BFE2F6B511DA955A0007EDC0 /* RewriteMacros.d in Sources */,
|
||||
BFE2F6B711DA955A0007EDC0 /* RewriteObjC.d in Sources */,
|
||||
BFE2F6B911DA955A0007EDC0 /* Rewriter.d in Sources */,
|
||||
BFE2F6BB11DA955A0007EDC0 /* RewriteRope.d in Sources */,
|
||||
BFE2F6BD11DA955A0007EDC0 /* RewriteTest.d in Sources */,
|
||||
BFE2F6BF11DA955A0007EDC0 /* TokenRewriter.d in Sources */,
|
||||
BFE2F6C111DA955A0007EDC0 /* DeltaTree.cpp in Sources */,
|
||||
BFE2F6C211DA955A0007EDC0 /* FixItRewriter.cpp in Sources */,
|
||||
BFE2F6C311DA955A0007EDC0 /* FrontendActions.cpp in Sources */,
|
||||
BFE2F6C411DA955A0007EDC0 /* HTMLPrint.cpp in Sources */,
|
||||
BFE2F6C511DA955A0007EDC0 /* HTMLRewrite.cpp in Sources */,
|
||||
BFE2F6C611DA955A0007EDC0 /* Makefile in Sources */,
|
||||
BFE2F6C711DA955A0007EDC0 /* DeltaTree.d in Sources */,
|
||||
BFE2F6C911DA955A0007EDC0 /* HTMLRewrite.d in Sources */,
|
||||
BFE2F6CB11DA955A0007EDC0 /* Rewriter.d in Sources */,
|
||||
BFE2F6CD11DA955A0007EDC0 /* RewriteRope.d in Sources */,
|
||||
BFE2F6CF11DA955A0007EDC0 /* TokenRewriter.d in Sources */,
|
||||
BFE2F6D111DA955A0007EDC0 /* RewriteMacros.cpp in Sources */,
|
||||
BFE2F6D211DA955A0007EDC0 /* RewriteObjC.cpp in Sources */,
|
||||
BFE2F6D311DA955A0007EDC0 /* Rewriter.cpp in Sources */,
|
||||
BFE2F6D411DA955A0007EDC0 /* RewriteRope.cpp in Sources */,
|
||||
BFE2F6D511DA955A0007EDC0 /* RewriteTest.cpp in Sources */,
|
||||
BFE2F6D611DA955A0007EDC0 /* TokenRewriter.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -118,8 +118,8 @@ classes somewhere else, or introduce some other solution.</p>
|
||||
<p>The Clang Diagnostics subsystem is an important part of how the compiler
|
||||
communicates with the human. Diagnostics are the warnings and errors produced
|
||||
when the code is incorrect or dubious. In Clang, each diagnostic produced has
|
||||
(at the minimum) a unique ID, a <a href="#SourceLocation">SourceLocation</a> to
|
||||
"put the caret", an English translation associated with it, and a severity (e.g.
|
||||
(at the minimum) a unique ID, an English translation associated with it, a <a
|
||||
href="#SourceLocation">SourceLocation</a> to "put the caret", and a severity (e.g.
|
||||
<tt>WARNING</tt> or <tt>ERROR</tt>). They can also optionally include a number
|
||||
of arguments to the dianostic (which fill in "%0"'s in the string) as well as a
|
||||
number of source ranges that related to the diagnostic.</p>
|
||||
@ -127,7 +127,7 @@ number of source ranges that related to the diagnostic.</p>
|
||||
<p>In this section, we'll be giving examples produced by the Clang command line
|
||||
driver, but diagnostics can be <a href="#DiagnosticClient">rendered in many
|
||||
different ways</a> depending on how the DiagnosticClient interface is
|
||||
implemented. A representative example of a diagonstic is:</p>
|
||||
implemented. A representative example of a diagnostic is:</p>
|
||||
|
||||
<pre>
|
||||
t.c:38:15: error: invalid operands to binary expression ('int *' and '_Complex float')
|
||||
@ -709,7 +709,7 @@ be the location of the "c" identifier.</li>
|
||||
|
||||
<li><b>void* "AnnotationValue"</b> - This contains an opaque object that the
|
||||
parser gets from Sema through an Actions module, it is passed around and Sema
|
||||
intepretes it, based on the type of annotation token.</li>
|
||||
interprets it, based on the type of annotation token.</li>
|
||||
|
||||
<li><b>TokenKind "Kind"</b> - This indicates the kind of Annotation token this
|
||||
is. See below for the different valid kinds.</li>
|
||||
|
@ -7,7 +7,7 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL := ../../..
|
||||
CLANG_LEVEL := ..
|
||||
DIRS := tools
|
||||
|
||||
ifdef BUILD_FOR_WEBSITE
|
||||
@ -22,7 +22,7 @@ $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
|
||||
-e 's/@abs_top_builddir@/../g' > $@
|
||||
endif
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
HTML := $(wildcard $(PROJ_SRC_DIR)/*.html) \
|
||||
$(wildcard $(PROJ_SRC_DIR)/*.css)
|
||||
|
@ -144,6 +144,15 @@ deserialized from the precompiled header. These statistics can be
|
||||
useful to determine whether the precompiled header implementation can
|
||||
be improved by making more of the implementation lazy.</p>
|
||||
|
||||
<p>Precompiled headers can be chained. When you create a PCH while
|
||||
including an existing PCH, Clang can create the new PCH by referencing
|
||||
the original file and only writing the new data to the new file. For
|
||||
example, you could create a PCH out of all the headers that are very
|
||||
commonly used throughout your project, and then create a PCH for every
|
||||
single source file in the project that includes the code that is
|
||||
specific to that file, so that recompiling the file itself is very fast,
|
||||
without duplicating the data from the common headers for every file.</p>
|
||||
|
||||
<h2 id="contents">Precompiled Header Contents</h2>
|
||||
|
||||
<img src="PCHLayout.png" align="right" alt="Precompiled header layout">
|
||||
@ -209,6 +218,27 @@ contents are verified along with the rest of the metadata.</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<p>A chained PCH file (that is, one that references another PCH) has
|
||||
a slightly different metadata block, which contains the following
|
||||
information:</p>
|
||||
|
||||
<dl>
|
||||
<dt>Referenced file</dt>
|
||||
<dd>The name of the referenced PCH file. It is looked up like a file
|
||||
specified using -include-pch.</dd>
|
||||
|
||||
<dt>PCH version</dt>
|
||||
<dd>This is the same as in normal PCH files.</dd>
|
||||
|
||||
<dt>Original file name</dt>
|
||||
<dd>The full path of the header that was used to generate this
|
||||
precompiled header.</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<p>The language options, target architecture and predefines buffer data
|
||||
is taken from the end of the chain, since they have to match anyway.</p>
|
||||
|
||||
<h3 id="sourcemgr">Source Manager Block</h3>
|
||||
|
||||
<p>The source manager block contains the serialized representation of
|
||||
|
@ -36,7 +36,7 @@ td {
|
||||
<ul>
|
||||
<li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
|
||||
<li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li>
|
||||
<li><a href="#diagnostics_categories">Diagnostic Categories</a><li>
|
||||
<li><a href="#diagnostics_categories">Diagnostic Categories</a></li>
|
||||
<li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li>
|
||||
<li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li>
|
||||
</ul>
|
||||
@ -53,16 +53,6 @@ td {
|
||||
<li><a href="#c_ms">Microsoft extensions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#objc">Objective-C Language Features</a>
|
||||
<ul>
|
||||
<li><a href="#objc_incompatibilities">Intentional Incompatibilities with
|
||||
GCC</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#cxx">C++ Language Features</a>
|
||||
</li>
|
||||
<li><a href="#objcxx">Objective C++ Language Features</a>
|
||||
</li>
|
||||
<li><a href="#target_features">Target-Specific Features and Limitations</a>
|
||||
<ul>
|
||||
<li><a href="#target_arch">CPU Architectures Features and Limitations</a>
|
||||
@ -261,11 +251,28 @@ when this is enabled, Clang will print something like:</p>
|
||||
<p>When this is disabled, Clang will just print:</p>
|
||||
|
||||
<pre>
|
||||
test.c:28:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
|
||||
<b><font color="black">test.c:28:8: <font color="magenta">warning</font>: extra tokens at end of #endif directive [-Wextra-tokens]</font></b>
|
||||
#endif bad
|
||||
<font color="green">^</font>
|
||||
<font color="green">//</font>
|
||||
</pre>
|
||||
|
||||
</dd>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<dt id="opt_fcolor_diagnostics"><b>-f[no-]color-diagnostics</b>: </dt>
|
||||
<dd>This option, which defaults to on when a color-capable terminal is
|
||||
detected, controls whether or not Clang prints diagnostics in color.
|
||||
When this option is enabled, Clang will use colors to highlight
|
||||
specific parts of the diagnostic, e.g.,
|
||||
|
||||
<pre>
|
||||
<test.c:2:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
|
||||
#endif bad
|
||||
^
|
||||
//
|
||||
</pre>
|
||||
</dd>'
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<dt id="opt_fdiagnostics-show-option"><b>-f[no-]diagnostics-show-option</b>:
|
||||
Enable <tt>[-Woption]</tt> information in diagnostic line.</dt>
|
||||
@ -386,6 +393,66 @@ by commenting them out.</p>
|
||||
and <a href="">-Wbaz</a>.</p>
|
||||
</dd>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<dt id="opt_Wambiguous-member-template"><b>-Wambiguous-member-template</b>:
|
||||
Warn about unqualified uses of a member template whose name resolves
|
||||
to another template at the location of the use.</dt>
|
||||
<dd>This option, which defaults to on, enables a warning in the
|
||||
following code:</p>
|
||||
|
||||
<pre>
|
||||
template<typename T> struct set{};
|
||||
template<typename T> struct trait { typedef const T& type; };
|
||||
struct Value {
|
||||
template<typename T> void set(typename trait<T>::type value) {}
|
||||
};
|
||||
void foo() {
|
||||
Value v;
|
||||
v.set<double>(3.2);
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>C++ [basic.lookup.classref] requires this to be an error, but,
|
||||
because it's hard to work around, Clang downgrades it to a warning as
|
||||
an extension.</p>
|
||||
</dd>
|
||||
|
||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
|
||||
<dt id="opt_Wbind-to-temporary-copy"><b>-Wbind-to-temporary-copy</b>: Warn about
|
||||
an unusable copy constructor when binding a reference to a temporary.</dt>
|
||||
<dd>This option, which defaults to on, enables warnings about binding a
|
||||
reference to a temporary when the temporary doesn't have a usable copy
|
||||
constructor. For example:</p>
|
||||
|
||||
<pre>
|
||||
struct NonCopyable {
|
||||
NonCopyable();
|
||||
private:
|
||||
NonCopyable(const NonCopyable&);
|
||||
};
|
||||
void foo(const NonCopyable&);
|
||||
void bar() {
|
||||
foo(NonCopyable()); // Disallowed in C++98; allowed in C++0x.
|
||||
}
|
||||
</pre>
|
||||
<pre>
|
||||
struct NonCopyable2 {
|
||||
NonCopyable2();
|
||||
NonCopyable2(NonCopyable2&);
|
||||
};
|
||||
void foo(const NonCopyable2&);
|
||||
void bar() {
|
||||
foo(NonCopyable2()); // Disallowed in C++98; allowed in C++0x.
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>Note that if <tt>NonCopyable2::NonCopyable2()</tt> has a default
|
||||
argument whose instantiation produces a compile error, that error will
|
||||
still be a hard error in C++98 mode even if this warning is turned
|
||||
off.</p>
|
||||
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
@ -717,11 +784,6 @@ extensions are not implemented yet:</p>
|
||||
a relatively small feature, so it is likely to be implemented relatively
|
||||
soon.</li>
|
||||
|
||||
<li>clang does not support attributes on function pointers
|
||||
(<a href="http://llvm.org/bugs/show_bug.cgi?id=2461">bug 2461</a>). This is
|
||||
a relatively important feature, so it is likely to be implemented relatively
|
||||
soon.</li>
|
||||
|
||||
<li>clang does not support #pragma weak
|
||||
(<a href="http://llvm.org/bugs/show_bug.cgi?id=3679">bug 3679</a>). Due to
|
||||
the uses described in the bug, this is likely to be implemented at some
|
||||
@ -824,45 +886,6 @@ controlling record layout. GCC also contains support for this feature,
|
||||
however where MSVC and GCC are incompatible clang follows the MSVC
|
||||
definition.</li>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="objc">Objective-C Language Features</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
|
||||
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
|
||||
<h3 id="objc_incompatibilities">Intentional Incompatibilities with GCC</h3>
|
||||
<!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
|
||||
|
||||
<p>No cast of super, no lvalue casts.</p>
|
||||
|
||||
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="cxx">C++ Language Features</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<p>At this point, Clang C++ is not production-quality and is not recommended for use beyond experimentation. However, Clang C++ support
|
||||
is under active development and is progressing rapidly. Please see the <a
|
||||
href="http://clang.llvm.org/cxx_status.html">C++ Status</a> page for details or
|
||||
ask on the mailing list about how you can help.</p>
|
||||
|
||||
<p>Note that released Clang compilers will refuse to even try to use clang to compile C++ code unless you pass the <tt>-ccc-clang-cxx</tt> option to the driver. To turn on Clang's C++ support, please pass that flag. Clang compilers built from the Subversion trunk enable C++ support by default, and do not require the <tt>-ccc-clang-cxx</tt> flag.</p>
|
||||
|
||||
<p>Clang strives to strictly conform to the C++ standard. That means
|
||||
it will reject invalid C++ code that another compiler may accept. If
|
||||
Clang reports errors in your code, please check
|
||||
the <a href="http://clang.llvm.org/cxx_compatibility.html">C++
|
||||
Compatibility</a> page to see whether they are C++-conformance bugs
|
||||
and how you can fix them.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="objcxx">Objective C++ Language Features</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
||||
<p>At this point, Clang C++ support is not generally useful (and therefore,
|
||||
neither is Objective-C++). Please see the <a href="#cxx">C++ section</a> for
|
||||
more information.</p>
|
||||
|
||||
<!-- ======================================================================= -->
|
||||
<h2 id="target_features">Target-Specific Features and Limitations</h2>
|
||||
<!-- ======================================================================= -->
|
||||
|
@ -37,10 +37,11 @@ clean:
|
||||
else
|
||||
|
||||
# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
|
||||
LEVEL := ../../../..
|
||||
include $(LEVEL)/Makefile.common
|
||||
CLANG_LEVEL := ../..
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
CLANG_VERSION := $(shell cat $(PROJ_SRC_DIR)/../../VER)
|
||||
CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
|
||||
$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
|
||||
|
||||
SRC_DOC_DIR=$(PROJ_SRC_DIR)/
|
||||
DST_HTML_DIR=$(PROJ_OBJ_DIR)/
|
||||
|
@ -7,8 +7,8 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../..
|
||||
CLANG_LEVEL := ..
|
||||
|
||||
PARALLEL_DIRS := clang-interpreter PrintFunctionNames wpa
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -1,26 +1,10 @@
|
||||
set(SHARED_LIBRARY TRUE)
|
||||
set(MODULE TRUE)
|
||||
|
||||
set(LLVM_NO_RTTI 1)
|
||||
|
||||
set(LLVM_USED_LIBS
|
||||
clangIndex
|
||||
clangFrontend
|
||||
clangDriver
|
||||
clangSema
|
||||
clangAnalysis
|
||||
clangAST
|
||||
clangParse
|
||||
clangLex
|
||||
clangBasic)
|
||||
|
||||
set( LLVM_LINK_COMPONENTS
|
||||
bitreader
|
||||
mc
|
||||
core
|
||||
)
|
||||
|
||||
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
|
||||
|
||||
set_target_properties(PrintFunctionNames
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX)
|
||||
LINKER_LANGUAGE CXX
|
||||
PREFIX "")
|
||||
|
@ -7,21 +7,13 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../../..
|
||||
CLANG_LEVEL := ../..
|
||||
LIBRARYNAME = PrintFunctionNames
|
||||
|
||||
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
|
||||
|
||||
# Include this here so we can get the configuration of the targets that have
|
||||
# been configured for construction. We have to do this early so we can set up
|
||||
# LINK_COMPONENTS before including Makefile.rules
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
LINK_LIBS_IN_SHARED = 1
|
||||
SHARED_LIBRARY = 1
|
||||
|
||||
LINK_COMPONENTS := bitreader mc core
|
||||
USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
|
||||
clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -31,11 +31,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class PrintFunctionNamesAction : public ASTFrontendAction {
|
||||
class PrintFunctionNamesAction : public PluginASTAction {
|
||||
protected:
|
||||
ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
|
||||
return new PrintFunctionsConsumer();
|
||||
}
|
||||
|
||||
bool ParseArgs(const std::vector<std::string>& args) {
|
||||
for (unsigned i=0; i<args.size(); ++i)
|
||||
llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n";
|
||||
if (args.size() && args[0] == "help")
|
||||
PrintHelp(llvm::errs());
|
||||
|
||||
return true;
|
||||
}
|
||||
void PrintHelp(llvm::raw_ostream& ros) {
|
||||
ros << "Help for PrintFunctionNames plugin goes here\n";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS
|
||||
jit
|
||||
interpreter
|
||||
nativecodegen
|
||||
asmparser
|
||||
bitreader
|
||||
bitwriter
|
||||
codegen
|
||||
ipo
|
||||
selectiondag
|
||||
)
|
||||
|
@ -7,24 +7,18 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../../..
|
||||
CLANG_LEVEL := ../..
|
||||
|
||||
TOOLNAME = clang-interpreter
|
||||
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
|
||||
NO_INSTALL = 1
|
||||
|
||||
# No plugins, optimize startup time.
|
||||
TOOL_NO_EXPORTS = 1
|
||||
|
||||
# Include this here so we can get the configuration of the targets that have
|
||||
# been configured for construction. We have to do this early so we can set up
|
||||
# LINK_COMPONENTS before including Makefile.rules
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \
|
||||
selectiondag
|
||||
selectiondag asmparser
|
||||
USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangSema.a \
|
||||
clangChecker.a clangAnalysis.a clangRewrite.a clangAST.a \
|
||||
clangParse.a clangLex.a clangBasic.a
|
||||
|
||||
include $(LLVM_SRC_ROOT)/Makefile.rules
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -7,10 +7,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/CodeGen/CodeGenAction.h"
|
||||
#include "clang/Driver/Compilation.h"
|
||||
#include "clang/Driver/Driver.h"
|
||||
#include "clang/Driver/Tool.h"
|
||||
#include "clang/Frontend/CodeGenAction.h"
|
||||
#include "clang/Frontend/CompilerInvocation.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Frontend/DiagnosticOptions.h"
|
||||
|
@ -6,6 +6,8 @@ set(LLVM_USED_LIBS
|
||||
clangDriver
|
||||
clangSema
|
||||
clangAnalysis
|
||||
clangChecker
|
||||
clangRewrite
|
||||
clangAST
|
||||
clangParse
|
||||
clangLex
|
||||
|
@ -7,22 +7,17 @@
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../../..
|
||||
CLANG_LEVEL := ../..
|
||||
|
||||
TOOLNAME = clang-wpa
|
||||
CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
|
||||
NO_INSTALL = 1
|
||||
|
||||
# No plugins, optimize startup time.
|
||||
TOOL_NO_EXPORTS = 1
|
||||
|
||||
# Include this here so we can get the configuration of the targets that have
|
||||
# been configured for construction. We have to do this early so we can set up
|
||||
# LINK_COMPONENTS before including Makefile.rules
|
||||
include $(LEVEL)/Makefile.config
|
||||
LINK_COMPONENTS := asmparser bitreader mc core
|
||||
USEDLIBS = clangChecker.a clangIndex.a clangFrontend.a clangDriver.a \
|
||||
clangSema.a clangAnalysis.a clangAST.a clangParse.a clangLex.a \
|
||||
clangBasic.a
|
||||
|
||||
LINK_COMPONENTS := bitreader mc core
|
||||
USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \
|
||||
clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a
|
||||
|
||||
include $(LLVM_SRC_ROOT)/Makefile.rules
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -14,9 +14,18 @@
|
||||
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Checker/PathSensitive/AnalysisManager.h"
|
||||
#include "clang/Checker/PathSensitive/GRExprEngine.h"
|
||||
#include "clang/Checker/PathSensitive/GRTransferFuncs.h"
|
||||
#include "clang/Checker/Checkers/LocalCheckers.h"
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
#include "clang/Index/CallGraph.h"
|
||||
#include "clang/Index/Indexer.h"
|
||||
#include "clang/Index/TranslationUnit.h"
|
||||
#include "clang/Index/DeclReferenceMap.h"
|
||||
#include "clang/Index/SelectorMap.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
@ -26,11 +35,50 @@ using namespace idx;
|
||||
static llvm::cl::list<std::string>
|
||||
InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input AST files>"));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
ViewCallGraph("view-call-graph", llvm::cl::desc("Display the call graph."));
|
||||
|
||||
static llvm::cl::opt<std::string>
|
||||
AnalyzeFunction("analyze-function",
|
||||
llvm::cl::desc("Specify the entry function."));
|
||||
|
||||
namespace {
|
||||
// A thin wrapper over ASTUnit implementing the TranslationUnit interface.
|
||||
class ASTUnitTU : public TranslationUnit {
|
||||
ASTUnit *AST;
|
||||
DeclReferenceMap DeclRefMap;
|
||||
SelectorMap SelMap;
|
||||
|
||||
public:
|
||||
ASTUnitTU(ASTUnit *ast)
|
||||
: AST(ast), DeclRefMap(AST->getASTContext()), SelMap(AST->getASTContext()) {
|
||||
}
|
||||
|
||||
virtual ASTContext &getASTContext() {
|
||||
return AST->getASTContext();
|
||||
}
|
||||
|
||||
virtual Preprocessor &getPreprocessor() {
|
||||
return AST->getPreprocessor();
|
||||
}
|
||||
|
||||
virtual DeclReferenceMap &getDeclReferenceMap() {
|
||||
return DeclRefMap;
|
||||
}
|
||||
|
||||
virtual SelectorMap &getSelectorMap() {
|
||||
return SelMap;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv, "clang-wpa");
|
||||
FileManager FileMgr;
|
||||
std::vector<ASTUnit*> ASTUnits;
|
||||
|
||||
Program Prog;
|
||||
Indexer Idxer(Prog);
|
||||
|
||||
if (InputFilenames.empty())
|
||||
return 0;
|
||||
|
||||
@ -46,11 +94,52 @@ int main(int argc, char **argv) {
|
||||
ASTUnits.push_back(AST.take());
|
||||
}
|
||||
|
||||
llvm::OwningPtr<CallGraph> CG;
|
||||
CG.reset(new CallGraph());
|
||||
if (ViewCallGraph) {
|
||||
llvm::OwningPtr<CallGraph> CG;
|
||||
CG.reset(new CallGraph(Prog));
|
||||
|
||||
for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
|
||||
CG->addTU(ASTUnits[i]->getASTContext());
|
||||
for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
|
||||
CG->addTU(ASTUnits[i]->getASTContext());
|
||||
|
||||
CG->ViewCallGraph();
|
||||
CG->ViewCallGraph();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (AnalyzeFunction.empty())
|
||||
return 0;
|
||||
|
||||
// Feed all ASTUnits to the Indexer.
|
||||
for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i) {
|
||||
ASTUnitTU *TU = new ASTUnitTU(ASTUnits[i]);
|
||||
Idxer.IndexAST(TU);
|
||||
}
|
||||
|
||||
Entity Ent = Entity::get(AnalyzeFunction, Prog);
|
||||
FunctionDecl *FD;
|
||||
TranslationUnit *TU;
|
||||
llvm::tie(FD, TU) = Idxer.getDefinitionFor(Ent);
|
||||
|
||||
if (!FD)
|
||||
return 0;
|
||||
|
||||
// Create an analysis engine.
|
||||
Preprocessor &PP = TU->getPreprocessor();
|
||||
|
||||
// Hard code options for now.
|
||||
AnalysisManager AMgr(TU->getASTContext(), PP.getDiagnostics(),
|
||||
PP.getLangOptions(), /* PathDiagnostic */ 0,
|
||||
CreateRegionStoreManager,
|
||||
CreateRangeConstraintManager,
|
||||
/* MaxNodes */ 300000, /* MaxLoop */ 3,
|
||||
/* VisualizeEG */ false, /* VisualizeEGUbi */ false,
|
||||
/* PurgeDead */ true, /* EagerlyAssume */ false,
|
||||
/* TrimGraph */ false, /* InlineCall */ true);
|
||||
|
||||
GRTransferFuncs* TF = MakeCFRefCountTF(AMgr.getASTContext(), /*GC*/false,
|
||||
AMgr.getLangOptions());
|
||||
GRExprEngine Eng(AMgr, TF);
|
||||
|
||||
Eng.ExecuteWorkList(AMgr.getStackFrame(FD), AMgr.getMaxNodes());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
LEVEL = ../../..
|
||||
CLANG_LEVEL := ..
|
||||
DIRS := clang clang-c
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
@ -342,12 +342,6 @@ CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
|
||||
*/
|
||||
CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
|
||||
|
||||
/**
|
||||
* \brief Determine if the source location occurs within the main file
|
||||
* of the translation unit (as opposed to an included header).
|
||||
*/
|
||||
CINDEX_LINKAGE unsigned clang_isFromMainFile(CXSourceLocation loc);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -1092,7 +1086,9 @@ enum CXTypeKind {
|
||||
CXType_Enum = 106,
|
||||
CXType_Typedef = 107,
|
||||
CXType_ObjCInterface = 108,
|
||||
CXType_ObjCObjectPointer = 109
|
||||
CXType_ObjCObjectPointer = 109,
|
||||
CXType_FunctionNoProto = 110,
|
||||
CXType_FunctionProto = 111
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1144,6 +1140,17 @@ CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
|
||||
*/
|
||||
CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the result type associated with a function type.
|
||||
*/
|
||||
CINDEX_LINKAGE CXType clang_getResultType(CXType T);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the result type associated with a given cursor. This only
|
||||
* returns a valid type of the cursor refers to a function or method.
|
||||
*/
|
||||
CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
LEVEL = ../../../..
|
||||
CLANG_LEVEL := ../..
|
||||
DIRS :=
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
install-local::
|
||||
$(Echo) Installing Clang C API include files
|
||||
|
@ -62,6 +62,7 @@ namespace clang {
|
||||
class RecordDecl;
|
||||
class StoredDeclsMap;
|
||||
class TagDecl;
|
||||
class TemplateTemplateParmDecl;
|
||||
class TemplateTypeParmDecl;
|
||||
class TranslationUnitDecl;
|
||||
class TypeDecl;
|
||||
@ -75,6 +76,8 @@ namespace clang {
|
||||
/// ASTContext - This class holds long-lived AST nodes (such as types and
|
||||
/// decls) that can be referred to throughout the semantic analysis of a file.
|
||||
class ASTContext {
|
||||
ASTContext &this_() { return *this; }
|
||||
|
||||
std::vector<Type*> Types;
|
||||
llvm::FoldingSet<ExtQuals> ExtQualNodes;
|
||||
llvm::FoldingSet<ComplexType> ComplexTypes;
|
||||
@ -95,9 +98,12 @@ class ASTContext {
|
||||
llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes;
|
||||
llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes;
|
||||
llvm::FoldingSet<SubstTemplateTypeParmType> SubstTemplateTypeParmTypes;
|
||||
llvm::FoldingSet<TemplateSpecializationType> TemplateSpecializationTypes;
|
||||
llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&>
|
||||
TemplateSpecializationTypes;
|
||||
llvm::FoldingSet<ElaboratedType> ElaboratedTypes;
|
||||
llvm::FoldingSet<DependentNameType> DependentNameTypes;
|
||||
llvm::ContextualFoldingSet<DependentTemplateSpecializationType, ASTContext&>
|
||||
DependentTemplateSpecializationTypes;
|
||||
llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes;
|
||||
llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
|
||||
|
||||
@ -122,6 +128,30 @@ class ASTContext {
|
||||
/// \brief Mapping from ObjCContainers to their ObjCImplementations.
|
||||
llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls;
|
||||
|
||||
/// \brief Representation of a "canonical" template template parameter that
|
||||
/// is used in canonical template names.
|
||||
class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode {
|
||||
TemplateTemplateParmDecl *Parm;
|
||||
|
||||
public:
|
||||
CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm)
|
||||
: Parm(Parm) { }
|
||||
|
||||
TemplateTemplateParmDecl *getParam() const { return Parm; }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Parm); }
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||
TemplateTemplateParmDecl *Parm);
|
||||
};
|
||||
llvm::FoldingSet<CanonicalTemplateTemplateParm> CanonTemplateTemplateParms;
|
||||
|
||||
TemplateTemplateParmDecl *getCanonicalTemplateTemplateParmDecl(
|
||||
TemplateTemplateParmDecl *TTP);
|
||||
|
||||
/// \brief Whether __[u]int128_t identifier is installed.
|
||||
bool IsInt128Installed;
|
||||
|
||||
/// BuiltinVaListType - built-in va list type.
|
||||
/// This is initially null and set by Sema::LazilyCreateBuiltin when
|
||||
/// a builtin that takes a valist is encountered.
|
||||
@ -162,6 +192,8 @@ class ASTContext {
|
||||
/// \brief Type for the Block descriptor for Blocks CodeGen.
|
||||
RecordDecl *BlockDescriptorExtendedType;
|
||||
|
||||
TypeSourceInfo NullTypeSourceInfo;
|
||||
|
||||
/// \brief Keeps track of all declaration attributes.
|
||||
///
|
||||
/// Since so few decls have attrs, we keep them in a hash map instead of
|
||||
@ -302,7 +334,8 @@ public:
|
||||
/// \brief Note that the static data member \p Inst is an instantiation of
|
||||
/// the static data member template \p Tmpl of a class template.
|
||||
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl,
|
||||
TemplateSpecializationKind TSK);
|
||||
TemplateSpecializationKind TSK,
|
||||
SourceLocation PointOfInstantiation = SourceLocation());
|
||||
|
||||
/// \brief If the given using decl is an instantiation of a
|
||||
/// (possibly unresolved) using decl from a template instantiation,
|
||||
@ -329,6 +362,8 @@ public:
|
||||
overridden_cxx_method_iterator
|
||||
overridden_methods_end(const CXXMethodDecl *Method) const;
|
||||
|
||||
unsigned overridden_methods_size(const CXXMethodDecl *Method) const;
|
||||
|
||||
/// \brief Note that the given C++ \p Method overrides the given \p
|
||||
/// Overridden method.
|
||||
void addOverriddenMethod(const CXXMethodDecl *Method,
|
||||
@ -534,7 +569,7 @@ public:
|
||||
/// getVectorType - Return the unique reference to a vector type of
|
||||
/// the specified element type and size. VectorType must be a built-in type.
|
||||
QualType getVectorType(QualType VectorType, unsigned NumElts,
|
||||
bool AltiVec, bool IsPixel);
|
||||
VectorType::AltiVecSpecific AltiVecSpec);
|
||||
|
||||
/// getExtVectorType - Return the unique reference to an extended vector type
|
||||
/// of the specified element type and size. VectorType must be a built-in
|
||||
@ -585,7 +620,11 @@ public:
|
||||
|
||||
/// getTypedefType - Return the unique reference to the type for the
|
||||
/// specified typename decl.
|
||||
QualType getTypedefType(const TypedefDecl *Decl);
|
||||
QualType getTypedefType(const TypedefDecl *Decl, QualType Canon = QualType());
|
||||
|
||||
QualType getRecordType(const RecordDecl *Decl);
|
||||
|
||||
QualType getEnumType(const EnumDecl *Decl);
|
||||
|
||||
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST);
|
||||
|
||||
@ -599,13 +638,15 @@ public:
|
||||
QualType getTemplateSpecializationType(TemplateName T,
|
||||
const TemplateArgument *Args,
|
||||
unsigned NumArgs,
|
||||
QualType Canon = QualType(),
|
||||
bool IsCurrentInstantiation = false);
|
||||
QualType Canon = QualType());
|
||||
|
||||
QualType getCanonicalTemplateSpecializationType(TemplateName T,
|
||||
const TemplateArgument *Args,
|
||||
unsigned NumArgs);
|
||||
|
||||
QualType getTemplateSpecializationType(TemplateName T,
|
||||
const TemplateArgumentListInfo &Args,
|
||||
QualType Canon = QualType(),
|
||||
bool IsCurrentInstantiation = false);
|
||||
QualType Canon = QualType());
|
||||
|
||||
TypeSourceInfo *
|
||||
getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc,
|
||||
@ -619,10 +660,16 @@ public:
|
||||
NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
QualType Canon = QualType());
|
||||
QualType getDependentNameType(ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *NNS,
|
||||
const TemplateSpecializationType *TemplateId,
|
||||
QualType Canon = QualType());
|
||||
|
||||
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
const TemplateArgumentListInfo &Args);
|
||||
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
unsigned NumArgs,
|
||||
const TemplateArgument *Args);
|
||||
|
||||
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl);
|
||||
|
||||
@ -780,6 +827,10 @@ public:
|
||||
/// purpose in characters.
|
||||
CharUnits getObjCEncodingTypeSize(QualType t);
|
||||
|
||||
/// \brief Whether __[u]int128_t identifier is installed.
|
||||
bool isInt128Installed() const { return IsInt128Installed; }
|
||||
void setInt128Installed() { IsInt128Installed = true; }
|
||||
|
||||
/// This setter/getter represents the ObjC 'id' type. It is setup lazily, by
|
||||
/// Sema. id is always a (typedef for a) pointer type, a pointer to a struct.
|
||||
QualType getObjCIdType() const { return ObjCIdTypedefType; }
|
||||
@ -943,8 +994,9 @@ public:
|
||||
const ASTRecordLayout &
|
||||
getASTObjCImplementationLayout(const ObjCImplementationDecl *D);
|
||||
|
||||
/// getKeyFunction - Get the key function for the given record decl.
|
||||
/// The key function is, according to the Itanium C++ ABI section 5.2.3:
|
||||
/// getKeyFunction - Get the key function for the given record decl, or NULL
|
||||
/// if there isn't one. The key function is, according to the Itanium C++ ABI
|
||||
/// section 5.2.3:
|
||||
///
|
||||
/// ...the first non-pure virtual function that is not inline at the point
|
||||
/// of class definition.
|
||||
@ -1013,6 +1065,8 @@ public:
|
||||
return UnqualT1 == UnqualT2;
|
||||
}
|
||||
|
||||
bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2);
|
||||
|
||||
/// \brief Retrieves the "canonical" declaration of
|
||||
|
||||
/// \brief Retrieves the "canonical" nested name specifier for a
|
||||
@ -1272,6 +1326,8 @@ public:
|
||||
TypeSourceInfo *
|
||||
getTrivialTypeSourceInfo(QualType T, SourceLocation Loc = SourceLocation());
|
||||
|
||||
TypeSourceInfo *getNullTypeSourceInfo() { return &NullTypeSourceInfo; }
|
||||
|
||||
/// \brief Add a deallocation callback that will be invoked when the
|
||||
/// ASTContext is destroyed.
|
||||
///
|
||||
@ -1280,6 +1336,38 @@ public:
|
||||
/// \brief Data Pointer data that will be provided to the callback function
|
||||
/// when it is called.
|
||||
void AddDeallocation(void (*Callback)(void*), void *Data);
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Statistics
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// \brief The number of implicitly-declared default constructors.
|
||||
static unsigned NumImplicitDefaultConstructors;
|
||||
|
||||
/// \brief The number of implicitly-declared default constructors for
|
||||
/// which declarations were built.
|
||||
static unsigned NumImplicitDefaultConstructorsDeclared;
|
||||
|
||||
/// \brief The number of implicitly-declared copy constructors.
|
||||
static unsigned NumImplicitCopyConstructors;
|
||||
|
||||
/// \brief The number of implicitly-declared copy constructors for
|
||||
/// which declarations were built.
|
||||
static unsigned NumImplicitCopyConstructorsDeclared;
|
||||
|
||||
/// \brief The number of implicitly-declared copy assignment operators.
|
||||
static unsigned NumImplicitCopyAssignmentOperators;
|
||||
|
||||
/// \brief The number of implicitly-declared copy assignment operators for
|
||||
/// which declarations were built.
|
||||
static unsigned NumImplicitCopyAssignmentOperatorsDeclared;
|
||||
|
||||
/// \brief The number of implicitly-declared destructors.
|
||||
static unsigned NumImplicitDestructors;
|
||||
|
||||
/// \brief The number of implicitly-declared destructors for which
|
||||
/// declarations were built.
|
||||
static unsigned NumImplicitDestructorsDeclared;
|
||||
|
||||
private:
|
||||
ASTContext(const ASTContext&); // DO NOT IMPLEMENT
|
||||
@ -1308,6 +1396,11 @@ private:
|
||||
// by DeclContext objects. This probably should not be in ASTContext,
|
||||
// but we include it here so that ASTContext can quickly deallocate them.
|
||||
llvm::PointerIntPair<StoredDeclsMap*,1> LastSDM;
|
||||
|
||||
/// \brief A counter used to uniquely identify "blocks".
|
||||
unsigned int UniqueBlockByRefTypeID;
|
||||
unsigned int UniqueBlockParmTypeID;
|
||||
|
||||
friend class DeclContext;
|
||||
friend class DeclarationNameTable;
|
||||
void ReleaseDeclContextMaps();
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "clang/Basic/AttrKinds.h"
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
@ -25,6 +26,7 @@ namespace clang {
|
||||
class ASTContext;
|
||||
class IdentifierInfo;
|
||||
class ObjCInterfaceDecl;
|
||||
class Expr;
|
||||
}
|
||||
|
||||
// Defined in ASTContext.h
|
||||
@ -41,75 +43,9 @@ namespace clang {
|
||||
|
||||
/// Attr - This represents one attribute.
|
||||
class Attr {
|
||||
public:
|
||||
enum Kind {
|
||||
Alias,
|
||||
Aligned,
|
||||
AlignMac68k,
|
||||
AlwaysInline,
|
||||
AnalyzerNoReturn, // Clang-specific.
|
||||
Annotate,
|
||||
AsmLabel, // Represent GCC asm label extension.
|
||||
BaseCheck,
|
||||
Blocks,
|
||||
CDecl,
|
||||
Cleanup,
|
||||
Const,
|
||||
Constructor,
|
||||
Deprecated,
|
||||
Destructor,
|
||||
FastCall,
|
||||
Final,
|
||||
Format,
|
||||
FormatArg,
|
||||
GNUInline,
|
||||
Hiding,
|
||||
IBOutletKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
|
||||
IBOutletCollectionKind, // Clang-specific.
|
||||
IBActionKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
|
||||
Malloc,
|
||||
MaxFieldAlignment,
|
||||
NoDebug,
|
||||
NoInline,
|
||||
NonNull,
|
||||
NoReturn,
|
||||
NoThrow,
|
||||
ObjCException,
|
||||
ObjCNSObject,
|
||||
Override,
|
||||
CFReturnsRetained, // Clang/Checker-specific.
|
||||
CFReturnsNotRetained, // Clang/Checker-specific.
|
||||
NSReturnsRetained, // Clang/Checker-specific.
|
||||
NSReturnsNotRetained, // Clang/Checker-specific.
|
||||
Overloadable, // Clang-specific
|
||||
Packed,
|
||||
Pure,
|
||||
Regparm,
|
||||
ReqdWorkGroupSize, // OpenCL-specific
|
||||
Section,
|
||||
Sentinel,
|
||||
StdCall,
|
||||
ThisCall,
|
||||
TransparentUnion,
|
||||
Unavailable,
|
||||
Unused,
|
||||
Used,
|
||||
Visibility,
|
||||
WarnUnusedResult,
|
||||
Weak,
|
||||
WeakImport,
|
||||
WeakRef,
|
||||
|
||||
FIRST_TARGET_ATTRIBUTE,
|
||||
DLLExport,
|
||||
DLLImport,
|
||||
MSP430Interrupt,
|
||||
X86ForceAlignArgPointer
|
||||
};
|
||||
|
||||
private:
|
||||
Attr *Next;
|
||||
Kind AttrKind;
|
||||
attr::Kind AttrKind;
|
||||
bool Inherited : 1;
|
||||
|
||||
protected:
|
||||
@ -122,7 +58,7 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
Attr(Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
|
||||
Attr(attr::Kind AK) : Next(0), AttrKind(AK), Inherited(false) {}
|
||||
virtual ~Attr() {
|
||||
assert(Next == 0 && "Destroy didn't work");
|
||||
}
|
||||
@ -133,7 +69,7 @@ public:
|
||||
/// declarations.
|
||||
virtual bool isMerged() const { return true; }
|
||||
|
||||
Kind getKind() const { return AttrKind; }
|
||||
attr::Kind getKind() const { return AttrKind; }
|
||||
|
||||
Attr *getNext() { return Next; }
|
||||
const Attr *getNext() const { return Next; }
|
||||
@ -163,13 +99,15 @@ public:
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *) { return true; }
|
||||
};
|
||||
|
||||
#include "clang/AST/Attrs.inc"
|
||||
|
||||
class AttrWithString : public Attr {
|
||||
private:
|
||||
const char *Str;
|
||||
unsigned StrLen;
|
||||
protected:
|
||||
AttrWithString(Attr::Kind AK, ASTContext &C, llvm::StringRef s);
|
||||
AttrWithString(attr::Kind AK, ASTContext &C, llvm::StringRef s);
|
||||
llvm::StringRef getString() const { return llvm::StringRef(Str, StrLen); }
|
||||
void ReplaceString(ASTContext &C, llvm::StringRef newS);
|
||||
public:
|
||||
@ -179,9 +117,9 @@ public:
|
||||
#define DEF_SIMPLE_ATTR(ATTR) \
|
||||
class ATTR##Attr : public Attr { \
|
||||
public: \
|
||||
ATTR##Attr() : Attr(ATTR) {} \
|
||||
ATTR##Attr() : Attr(attr::ATTR) {} \
|
||||
virtual Attr *clone(ASTContext &C) const; \
|
||||
static bool classof(const Attr *A) { return A->getKind() == ATTR; } \
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::ATTR; } \
|
||||
static bool classof(const ATTR##Attr *A) { return true; } \
|
||||
}
|
||||
|
||||
@ -194,7 +132,7 @@ class MaxFieldAlignmentAttr : public Attr {
|
||||
|
||||
public:
|
||||
MaxFieldAlignmentAttr(unsigned alignment)
|
||||
: Attr(MaxFieldAlignment), Alignment(alignment) {}
|
||||
: Attr(attr::MaxFieldAlignment), Alignment(alignment) {}
|
||||
|
||||
/// getAlignment - The specified alignment in bits.
|
||||
unsigned getAlignment() const { return Alignment; }
|
||||
@ -203,36 +141,58 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == MaxFieldAlignment;
|
||||
return A->getKind() == attr::MaxFieldAlignment;
|
||||
}
|
||||
static bool classof(const MaxFieldAlignmentAttr *A) { return true; }
|
||||
};
|
||||
|
||||
DEF_SIMPLE_ATTR(AlignMac68k);
|
||||
|
||||
/// \brief Atribute for specifying the alignment of a variable or type.
|
||||
///
|
||||
/// This node will either contain the precise Alignment (in bits, not bytes!)
|
||||
/// or will contain the expression for the alignment attribute in the case of
|
||||
/// a dependent expression within a class or function template. At template
|
||||
/// instantiation time these are transformed into concrete attributes.
|
||||
class AlignedAttr : public Attr {
|
||||
unsigned Alignment;
|
||||
Expr *AlignmentExpr;
|
||||
public:
|
||||
AlignedAttr(unsigned alignment)
|
||||
: Attr(Aligned), Alignment(alignment) {}
|
||||
: Attr(attr::Aligned), Alignment(alignment), AlignmentExpr(0) {}
|
||||
AlignedAttr(Expr *E)
|
||||
: Attr(attr::Aligned), Alignment(0), AlignmentExpr(E) {}
|
||||
|
||||
/// getAlignmentExpr - Get a dependent alignment expression if one is present.
|
||||
Expr *getAlignmentExpr() const {
|
||||
return AlignmentExpr;
|
||||
}
|
||||
|
||||
/// isDependent - Is the alignment a dependent expression
|
||||
bool isDependent() const {
|
||||
return getAlignmentExpr();
|
||||
}
|
||||
|
||||
/// getAlignment - The specified alignment in bits. Requires !isDependent().
|
||||
unsigned getAlignment() const {
|
||||
assert(!isDependent() && "Cannot get a value dependent alignment");
|
||||
return Alignment;
|
||||
}
|
||||
|
||||
/// getAlignment - The specified alignment in bits.
|
||||
unsigned getAlignment() const { return Alignment; }
|
||||
|
||||
/// getMaxAlignment - Get the maximum alignment of attributes on this list.
|
||||
unsigned getMaxAlignment() const {
|
||||
const AlignedAttr *Next = getNext<AlignedAttr>();
|
||||
if (Next)
|
||||
return std::max(Next->getMaxAlignment(), Alignment);
|
||||
return std::max(Next->getMaxAlignment(), getAlignment());
|
||||
else
|
||||
return Alignment;
|
||||
return getAlignment();
|
||||
}
|
||||
|
||||
virtual Attr* clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == Aligned;
|
||||
return A->getKind() == attr::Aligned;
|
||||
}
|
||||
static bool classof(const AlignedAttr *A) { return true; }
|
||||
};
|
||||
@ -240,7 +200,7 @@ public:
|
||||
class AnnotateAttr : public AttrWithString {
|
||||
public:
|
||||
AnnotateAttr(ASTContext &C, llvm::StringRef ann)
|
||||
: AttrWithString(Annotate, C, ann) {}
|
||||
: AttrWithString(attr::Annotate, C, ann) {}
|
||||
|
||||
llvm::StringRef getAnnotation() const { return getString(); }
|
||||
|
||||
@ -248,7 +208,7 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == Annotate;
|
||||
return A->getKind() == attr::Annotate;
|
||||
}
|
||||
static bool classof(const AnnotateAttr *A) { return true; }
|
||||
};
|
||||
@ -256,7 +216,7 @@ public:
|
||||
class AsmLabelAttr : public AttrWithString {
|
||||
public:
|
||||
AsmLabelAttr(ASTContext &C, llvm::StringRef L)
|
||||
: AttrWithString(AsmLabel, C, L) {}
|
||||
: AttrWithString(attr::AsmLabel, C, L) {}
|
||||
|
||||
llvm::StringRef getLabel() const { return getString(); }
|
||||
|
||||
@ -264,7 +224,7 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == AsmLabel;
|
||||
return A->getKind() == attr::AsmLabel;
|
||||
}
|
||||
static bool classof(const AsmLabelAttr *A) { return true; }
|
||||
};
|
||||
@ -274,54 +234,56 @@ DEF_SIMPLE_ATTR(AlwaysInline);
|
||||
class AliasAttr : public AttrWithString {
|
||||
public:
|
||||
AliasAttr(ASTContext &C, llvm::StringRef aliasee)
|
||||
: AttrWithString(Alias, C, aliasee) {}
|
||||
: AttrWithString(attr::Alias, C, aliasee) {}
|
||||
|
||||
llvm::StringRef getAliasee() const { return getString(); }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Alias; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Alias; }
|
||||
static bool classof(const AliasAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class ConstructorAttr : public Attr {
|
||||
int priority;
|
||||
public:
|
||||
ConstructorAttr(int p) : Attr(Constructor), priority(p) {}
|
||||
ConstructorAttr(int p) : Attr(attr::Constructor), priority(p) {}
|
||||
|
||||
int getPriority() const { return priority; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Constructor; }
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::Constructor; }
|
||||
static bool classof(const ConstructorAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class DestructorAttr : public Attr {
|
||||
int priority;
|
||||
public:
|
||||
DestructorAttr(int p) : Attr(Destructor), priority(p) {}
|
||||
DestructorAttr(int p) : Attr(attr::Destructor), priority(p) {}
|
||||
|
||||
int getPriority() const { return priority; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Destructor; }
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::Destructor; }
|
||||
static bool classof(const DestructorAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class IBOutletAttr : public Attr {
|
||||
public:
|
||||
IBOutletAttr() : Attr(IBOutletKind) {}
|
||||
IBOutletAttr() : Attr(attr::IBOutlet) {}
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == IBOutletKind;
|
||||
return A->getKind() == attr::IBOutlet;
|
||||
}
|
||||
static bool classof(const IBOutletAttr *A) { return true; }
|
||||
};
|
||||
@ -330,7 +292,7 @@ class IBOutletCollectionAttr : public Attr {
|
||||
const ObjCInterfaceDecl *D;
|
||||
public:
|
||||
IBOutletCollectionAttr(const ObjCInterfaceDecl *d = 0)
|
||||
: Attr(IBOutletCollectionKind), D(d) {}
|
||||
: Attr(attr::IBOutletCollection), D(d) {}
|
||||
|
||||
const ObjCInterfaceDecl *getClass() const { return D; }
|
||||
|
||||
@ -338,35 +300,35 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == IBOutletCollectionKind;
|
||||
return A->getKind() == attr::IBOutletCollection;
|
||||
}
|
||||
static bool classof(const IBOutletCollectionAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class IBActionAttr : public Attr {
|
||||
public:
|
||||
IBActionAttr() : Attr(IBActionKind) {}
|
||||
IBActionAttr() : Attr(attr::IBAction) {}
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == IBActionKind;
|
||||
return A->getKind() == attr::IBAction;
|
||||
}
|
||||
static bool classof(const IBActionAttr *A) { return true; }
|
||||
};
|
||||
|
||||
DEF_SIMPLE_ATTR(AnalyzerNoReturn);
|
||||
DEF_SIMPLE_ATTR(Deprecated);
|
||||
DEF_SIMPLE_ATTR(Final);
|
||||
DEF_SIMPLE_ATTR(GNUInline);
|
||||
DEF_SIMPLE_ATTR(Malloc);
|
||||
DEF_SIMPLE_ATTR(NoReturn);
|
||||
DEF_SIMPLE_ATTR(NoInstrumentFunction);
|
||||
|
||||
class SectionAttr : public AttrWithString {
|
||||
public:
|
||||
SectionAttr(ASTContext &C, llvm::StringRef N)
|
||||
: AttrWithString(Section, C, N) {}
|
||||
: AttrWithString(attr::Section, C, N) {}
|
||||
|
||||
llvm::StringRef getName() const { return getString(); }
|
||||
|
||||
@ -374,7 +336,7 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == Section;
|
||||
return A->getKind() == attr::Section;
|
||||
}
|
||||
static bool classof(const SectionAttr *A) { return true; }
|
||||
};
|
||||
@ -408,7 +370,7 @@ public:
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
static bool classof(const Attr *A) { return A->getKind() == NonNull; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::NonNull; }
|
||||
static bool classof(const NonNullAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -416,7 +378,7 @@ class FormatAttr : public AttrWithString {
|
||||
int formatIdx, firstArg;
|
||||
public:
|
||||
FormatAttr(ASTContext &C, llvm::StringRef type, int idx, int first)
|
||||
: AttrWithString(Format, C, type), formatIdx(idx), firstArg(first) {}
|
||||
: AttrWithString(attr::Format, C, type), formatIdx(idx), firstArg(first) {}
|
||||
|
||||
llvm::StringRef getType() const { return getString(); }
|
||||
void setType(ASTContext &C, llvm::StringRef type);
|
||||
@ -426,27 +388,27 @@ public:
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Format; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Format; }
|
||||
static bool classof(const FormatAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class FormatArgAttr : public Attr {
|
||||
int formatIdx;
|
||||
public:
|
||||
FormatArgAttr(int idx) : Attr(FormatArg), formatIdx(idx) {}
|
||||
FormatArgAttr(int idx) : Attr(attr::FormatArg), formatIdx(idx) {}
|
||||
int getFormatIdx() const { return formatIdx; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == FormatArg; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::FormatArg; }
|
||||
static bool classof(const FormatArgAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class SentinelAttr : public Attr {
|
||||
int sentinel, NullPos;
|
||||
public:
|
||||
SentinelAttr(int sentinel_val, int nullPos) : Attr(Sentinel),
|
||||
SentinelAttr(int sentinel_val, int nullPos) : Attr(attr::Sentinel),
|
||||
sentinel(sentinel_val), NullPos(nullPos) {}
|
||||
int getSentinel() const { return sentinel; }
|
||||
int getNullPos() const { return NullPos; }
|
||||
@ -454,7 +416,7 @@ public:
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Sentinel; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Sentinel; }
|
||||
static bool classof(const SentinelAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -469,7 +431,7 @@ public:
|
||||
private:
|
||||
VisibilityTypes VisibilityType;
|
||||
public:
|
||||
VisibilityAttr(VisibilityTypes v) : Attr(Visibility),
|
||||
VisibilityAttr(VisibilityTypes v) : Attr(attr::Visibility),
|
||||
VisibilityType(v) {}
|
||||
|
||||
VisibilityTypes getVisibility() const { return VisibilityType; }
|
||||
@ -477,7 +439,8 @@ public:
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Visibility; }
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::Visibility; }
|
||||
static bool classof(const VisibilityAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -491,13 +454,14 @@ DEF_SIMPLE_ATTR(ObjCException);
|
||||
|
||||
class OverloadableAttr : public Attr {
|
||||
public:
|
||||
OverloadableAttr() : Attr(Overloadable) { }
|
||||
OverloadableAttr() : Attr(attr::Overloadable) { }
|
||||
|
||||
virtual bool isMerged() const { return false; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
static bool classof(const Attr *A) { return A->getKind() == Overloadable; }
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::Overloadable; }
|
||||
static bool classof(const OverloadableAttr *) { return true; }
|
||||
};
|
||||
|
||||
@ -509,14 +473,14 @@ public:
|
||||
private:
|
||||
BlocksAttrTypes BlocksAttrType;
|
||||
public:
|
||||
BlocksAttr(BlocksAttrTypes t) : Attr(Blocks), BlocksAttrType(t) {}
|
||||
BlocksAttr(BlocksAttrTypes t) : Attr(attr::Blocks), BlocksAttrType(t) {}
|
||||
|
||||
BlocksAttrTypes getType() const { return BlocksAttrType; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Blocks; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Blocks; }
|
||||
static bool classof(const BlocksAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -526,14 +490,14 @@ class CleanupAttr : public Attr {
|
||||
FunctionDecl *FD;
|
||||
|
||||
public:
|
||||
CleanupAttr(FunctionDecl *fd) : Attr(Cleanup), FD(fd) {}
|
||||
CleanupAttr(FunctionDecl *fd) : Attr(attr::Cleanup), FD(fd) {}
|
||||
|
||||
const FunctionDecl *getFunctionDecl() const { return FD; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Cleanup; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Cleanup; }
|
||||
static bool classof(const CleanupAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -545,14 +509,14 @@ class RegparmAttr : public Attr {
|
||||
unsigned NumParams;
|
||||
|
||||
public:
|
||||
RegparmAttr(unsigned np) : Attr(Regparm), NumParams(np) {}
|
||||
RegparmAttr(unsigned np) : Attr(attr::Regparm), NumParams(np) {}
|
||||
|
||||
unsigned getNumParams() const { return NumParams; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == Regparm; }
|
||||
static bool classof(const Attr *A) { return A->getKind() == attr::Regparm; }
|
||||
static bool classof(const RegparmAttr *A) { return true; }
|
||||
};
|
||||
|
||||
@ -560,7 +524,7 @@ class ReqdWorkGroupSizeAttr : public Attr {
|
||||
unsigned X, Y, Z;
|
||||
public:
|
||||
ReqdWorkGroupSizeAttr(unsigned X, unsigned Y, unsigned Z)
|
||||
: Attr(ReqdWorkGroupSize), X(X), Y(Y), Z(Z) {}
|
||||
: Attr(attr::ReqdWorkGroupSize), X(X), Y(Y), Z(Z) {}
|
||||
|
||||
unsigned getXDim() const { return X; }
|
||||
unsigned getYDim() const { return Y; }
|
||||
@ -570,22 +534,34 @@ public:
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) {
|
||||
return A->getKind() == ReqdWorkGroupSize;
|
||||
return A->getKind() == attr::ReqdWorkGroupSize;
|
||||
}
|
||||
static bool classof(const ReqdWorkGroupSizeAttr *A) { return true; }
|
||||
};
|
||||
|
||||
class InitPriorityAttr : public Attr {
|
||||
unsigned Priority;
|
||||
public:
|
||||
InitPriorityAttr(unsigned priority)
|
||||
: Attr(attr::InitPriority), Priority(priority) {}
|
||||
|
||||
virtual void Destroy(ASTContext &C) { Attr::Destroy(C); }
|
||||
|
||||
unsigned getPriority() const { return Priority; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::InitPriority; }
|
||||
static bool classof(const InitPriorityAttr *A) { return true; }
|
||||
};
|
||||
|
||||
// Checker-specific attributes.
|
||||
DEF_SIMPLE_ATTR(CFReturnsNotRetained);
|
||||
DEF_SIMPLE_ATTR(CFReturnsRetained);
|
||||
DEF_SIMPLE_ATTR(NSReturnsNotRetained);
|
||||
DEF_SIMPLE_ATTR(NSReturnsRetained);
|
||||
|
||||
// C++0x member checking attributes.
|
||||
DEF_SIMPLE_ATTR(BaseCheck);
|
||||
DEF_SIMPLE_ATTR(Hiding);
|
||||
DEF_SIMPLE_ATTR(Override);
|
||||
|
||||
// Target-specific attributes
|
||||
DEF_SIMPLE_ATTR(DLLImport);
|
||||
DEF_SIMPLE_ATTR(DLLExport);
|
||||
@ -594,14 +570,15 @@ class MSP430InterruptAttr : public Attr {
|
||||
unsigned Number;
|
||||
|
||||
public:
|
||||
MSP430InterruptAttr(unsigned n) : Attr(MSP430Interrupt), Number(n) {}
|
||||
MSP430InterruptAttr(unsigned n) : Attr(attr::MSP430Interrupt), Number(n) {}
|
||||
|
||||
unsigned getNumber() const { return Number; }
|
||||
|
||||
virtual Attr *clone(ASTContext &C) const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Attr *A) { return A->getKind() == MSP430Interrupt; }
|
||||
static bool classof(const Attr *A)
|
||||
{ return A->getKind() == attr::MSP430Interrupt; }
|
||||
static bool classof(const MSP430InterruptAttr *A) { return true; }
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,18 @@
|
||||
set(LLVM_TARGET_DEFINITIONS StmtNodes.td)
|
||||
set(LLVM_TARGET_DEFINITIONS ../Basic/Attr.td)
|
||||
tablegen(Attrs.inc
|
||||
-gen-clang-attr-classes
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrClasses
|
||||
DEPENDS Attrs.inc)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS ../Basic/StmtNodes.td)
|
||||
tablegen(StmtNodes.inc
|
||||
-gen-clang-stmt-nodes)
|
||||
add_custom_target(ClangStmtNodes
|
||||
DEPENDS StmtNodes.inc)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS ../Basic/DeclNodes.td)
|
||||
tablegen(DeclNodes.inc
|
||||
-gen-clang-decl-nodes)
|
||||
add_custom_target(ClangDeclNodes
|
||||
DEPENDS DeclNodes.inc)
|
||||
|
@ -247,6 +247,7 @@ public:
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isCharType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isWideCharType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isIntegralOrEnumerationType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealFloatingType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isComplexType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyComplexType)
|
||||
@ -269,8 +270,10 @@ public:
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isNullPtrType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDependentType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isOverloadableType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArrayType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasPointerRepresentation)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasObjCPointerRepresentation)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasFloatingRepresentation)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isPromotableIntegerType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isSignedIntegerType)
|
||||
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isUnsignedIntegerType)
|
||||
|
@ -28,6 +28,8 @@ class FunctionTemplateDecl;
|
||||
class Stmt;
|
||||
class CompoundStmt;
|
||||
class StringLiteral;
|
||||
class NestedNameSpecifier;
|
||||
class TemplateParameterList;
|
||||
class TemplateArgumentList;
|
||||
class MemberSpecializationInfo;
|
||||
class FunctionTemplateSpecializationInfo;
|
||||
@ -216,7 +218,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const NamedDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= NamedFirst && K <= NamedLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstNamed && K <= lastNamed; }
|
||||
};
|
||||
|
||||
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
|
||||
@ -342,6 +344,9 @@ public:
|
||||
static NamespaceDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<NamespaceDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// ValueDecl - Represent the declaration of a variable (in which case it is
|
||||
@ -361,7 +366,38 @@ public:
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const ValueDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= ValueFirst && K <= ValueLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstValue && K <= lastValue; }
|
||||
};
|
||||
|
||||
/// QualifierInfo - A struct with extended info about a syntactic
|
||||
/// name qualifier, to be used for the case of out-of-line declarations.
|
||||
struct QualifierInfo {
|
||||
/// NNS - The syntactic name qualifier.
|
||||
NestedNameSpecifier *NNS;
|
||||
/// NNSRange - The source range for the qualifier.
|
||||
SourceRange NNSRange;
|
||||
/// NumTemplParamLists - The number of template parameter lists
|
||||
/// that were matched against the template-ids occurring into the NNS.
|
||||
unsigned NumTemplParamLists;
|
||||
/// TemplParamLists - A new-allocated array of size NumTemplParamLists,
|
||||
/// containing pointers to the matched template parameter lists.
|
||||
TemplateParameterList** TemplParamLists;
|
||||
|
||||
/// Default constructor.
|
||||
QualifierInfo()
|
||||
: NNS(0), NNSRange(), NumTemplParamLists(0), TemplParamLists(0) {}
|
||||
/// setTemplateParameterListsInfo - Sets info about matched template
|
||||
/// parameter lists.
|
||||
void setTemplateParameterListsInfo(ASTContext &Context,
|
||||
unsigned NumTPLists,
|
||||
TemplateParameterList **TPLists);
|
||||
|
||||
void Destroy(ASTContext &Context);
|
||||
|
||||
private:
|
||||
// Copy constructor and copy assignment are disabled.
|
||||
QualifierInfo(const QualifierInfo&);
|
||||
QualifierInfo& operator=(const QualifierInfo&);
|
||||
};
|
||||
|
||||
/// \brief Represents a ValueDecl that came out of a declarator.
|
||||
@ -369,10 +405,8 @@ public:
|
||||
class DeclaratorDecl : public ValueDecl {
|
||||
// A struct representing both a TInfo and a syntactic qualifier,
|
||||
// to be used for the (uncommon) case of out-of-line declarations.
|
||||
struct ExtInfo {
|
||||
struct ExtInfo : public QualifierInfo {
|
||||
TypeSourceInfo *TInfo;
|
||||
NestedNameSpecifier *NNS;
|
||||
SourceRange NNSRange;
|
||||
};
|
||||
|
||||
llvm::PointerUnion<TypeSourceInfo*, ExtInfo*> DeclInfo;
|
||||
@ -392,32 +426,55 @@ public:
|
||||
|
||||
TypeSourceInfo *getTypeSourceInfo() const {
|
||||
return hasExtInfo()
|
||||
? DeclInfo.get<ExtInfo*>()->TInfo
|
||||
? getExtInfo()->TInfo
|
||||
: DeclInfo.get<TypeSourceInfo*>();
|
||||
}
|
||||
void setTypeSourceInfo(TypeSourceInfo *TI) {
|
||||
if (hasExtInfo())
|
||||
DeclInfo.get<ExtInfo*>()->TInfo = TI;
|
||||
getExtInfo()->TInfo = TI;
|
||||
else
|
||||
DeclInfo = TI;
|
||||
}
|
||||
|
||||
/// getInnerLocStart - Return SourceLocation representing start of source
|
||||
/// range ignoring outer template declarations.
|
||||
virtual SourceLocation getInnerLocStart() const { return getLocation(); }
|
||||
|
||||
/// getOuterLocStart - Return SourceLocation representing start of source
|
||||
/// range taking into account any outer template declarations.
|
||||
SourceLocation getOuterLocStart() const;
|
||||
SourceRange getSourceRange() const {
|
||||
return SourceRange(getOuterLocStart(), getLocation());
|
||||
}
|
||||
|
||||
NestedNameSpecifier *getQualifier() const {
|
||||
return hasExtInfo() ? DeclInfo.get<ExtInfo*>()->NNS : 0;
|
||||
return hasExtInfo() ? getExtInfo()->NNS : 0;
|
||||
}
|
||||
SourceRange getQualifierRange() const {
|
||||
return hasExtInfo() ? DeclInfo.get<ExtInfo*>()->NNSRange : SourceRange();
|
||||
return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange();
|
||||
}
|
||||
void setQualifierInfo(NestedNameSpecifier *Qualifier,
|
||||
SourceRange QualifierRange);
|
||||
|
||||
unsigned getNumTemplateParameterLists() const {
|
||||
return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
|
||||
}
|
||||
TemplateParameterList *getTemplateParameterList(unsigned index) const {
|
||||
assert(index < getNumTemplateParameterLists());
|
||||
return getExtInfo()->TemplParamLists[index];
|
||||
}
|
||||
void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
|
||||
TemplateParameterList **TPLists) {
|
||||
getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
|
||||
}
|
||||
|
||||
SourceLocation getTypeSpecStartLoc() const;
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const DeclaratorDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= DeclaratorFirst && K <= DeclaratorLast;
|
||||
return K >= firstDeclarator && K <= lastDeclarator;
|
||||
}
|
||||
};
|
||||
|
||||
@ -555,6 +612,7 @@ public:
|
||||
virtual void Destroy(ASTContext& C);
|
||||
virtual ~VarDecl();
|
||||
|
||||
virtual SourceLocation getInnerLocStart() const;
|
||||
virtual SourceRange getSourceRange() const;
|
||||
|
||||
StorageClass getStorageClass() const { return (StorageClass)SClass; }
|
||||
@ -908,7 +966,7 @@ public:
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const VarDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= VarFirst && K <= VarLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstVar && K <= lastVar; }
|
||||
};
|
||||
|
||||
class ImplicitParamDecl : public VarDecl {
|
||||
@ -1063,6 +1121,15 @@ public:
|
||||
None, Extern, Static, PrivateExtern
|
||||
};
|
||||
|
||||
/// \brief The kind of templated function a FunctionDecl can be.
|
||||
enum TemplatedKind {
|
||||
TK_NonTemplate,
|
||||
TK_FunctionTemplate,
|
||||
TK_MemberSpecialization,
|
||||
TK_FunctionTemplateSpecialization,
|
||||
TK_DependentFunctionTemplateSpecialization
|
||||
};
|
||||
|
||||
private:
|
||||
/// ParamInfo - new[]'d array of pointers to VarDecls for the formal
|
||||
/// parameters of this function. This is null if a prototype or if there are
|
||||
@ -1154,17 +1221,31 @@ public:
|
||||
bool Qualified) const;
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(getLocation(), EndRangeLoc);
|
||||
return SourceRange(getOuterLocStart(), EndRangeLoc);
|
||||
}
|
||||
void setLocEnd(SourceLocation E) {
|
||||
EndRangeLoc = E;
|
||||
}
|
||||
|
||||
/// \brief Returns true if the function has a body (definition). The
|
||||
/// function body might be in any of the (re-)declarations of this
|
||||
/// function. The variant that accepts a FunctionDecl pointer will
|
||||
/// set that function declaration to the actual declaration
|
||||
/// containing the body (if there is one).
|
||||
bool hasBody(const FunctionDecl *&Definition) const;
|
||||
|
||||
virtual bool hasBody() const {
|
||||
const FunctionDecl* Definition;
|
||||
return hasBody(Definition);
|
||||
}
|
||||
|
||||
/// getBody - Retrieve the body (definition) of the function. The
|
||||
/// function body might be in any of the (re-)declarations of this
|
||||
/// function. The variant that accepts a FunctionDecl pointer will
|
||||
/// set that function declaration to the actual declaration
|
||||
/// containing the body (if there is one).
|
||||
/// NOTE: For checking if there is a body, use hasBody() instead, to avoid
|
||||
/// unnecessary PCH de-serialization of the body.
|
||||
Stmt *getBody(const FunctionDecl *&Definition) const;
|
||||
|
||||
virtual Stmt *getBody() const {
|
||||
@ -1301,6 +1382,12 @@ public:
|
||||
QualType getResultType() const {
|
||||
return getType()->getAs<FunctionType>()->getResultType();
|
||||
}
|
||||
|
||||
/// \brief Determine the type of an expression that calls this function.
|
||||
QualType getCallResultType() const {
|
||||
return getType()->getAs<FunctionType>()->getCallResultType(getASTContext());
|
||||
}
|
||||
|
||||
StorageClass getStorageClass() const { return StorageClass(SClass); }
|
||||
void setStorageClass(StorageClass SC) { SClass = SC; }
|
||||
|
||||
@ -1355,6 +1442,9 @@ public:
|
||||
/// X<int>::A is required, it will be instantiated from the
|
||||
/// declaration returned by getInstantiatedFromMemberFunction().
|
||||
FunctionDecl *getInstantiatedFromMemberFunction() const;
|
||||
|
||||
/// \brief What kind of templated function this is.
|
||||
TemplatedKind getTemplatedKind() const;
|
||||
|
||||
/// \brief If this function is an instantiation of a member function of a
|
||||
/// class template specialization, retrieves the member specialization
|
||||
@ -1437,8 +1527,6 @@ public:
|
||||
/// \brief Specify that this function declaration is actually a function
|
||||
/// template specialization.
|
||||
///
|
||||
/// \param Context the AST context in which this function resides.
|
||||
///
|
||||
/// \param Template the function template that this function template
|
||||
/// specialization specializes.
|
||||
///
|
||||
@ -1450,11 +1538,53 @@ public:
|
||||
/// be inserted.
|
||||
///
|
||||
/// \param TSK the kind of template specialization this is.
|
||||
///
|
||||
/// \param TemplateArgsAsWritten location info of template arguments.
|
||||
///
|
||||
/// \param PointOfInstantiation point at which the function template
|
||||
/// specialization was first instantiated.
|
||||
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
||||
const TemplateArgumentList *TemplateArgs,
|
||||
void *InsertPos,
|
||||
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
|
||||
const TemplateArgumentListInfo *TemplateArgsAsWritten = 0);
|
||||
const TemplateArgumentListInfo *TemplateArgsAsWritten = 0,
|
||||
SourceLocation PointOfInstantiation = SourceLocation());
|
||||
|
||||
/// \brief Specify that this function declaration is actually a function
|
||||
/// template specialization.
|
||||
///
|
||||
/// \param Template the function template that this function template
|
||||
/// specialization specializes.
|
||||
///
|
||||
/// \param NumTemplateArgs number of template arguments that produced this
|
||||
/// function template specialization from the template.
|
||||
///
|
||||
/// \param TemplateArgs array of template arguments that produced this
|
||||
/// function template specialization from the template.
|
||||
///
|
||||
/// \param TSK the kind of template specialization this is.
|
||||
///
|
||||
/// \param NumTemplateArgsAsWritten number of template arguments that produced
|
||||
/// this function template specialization from the template.
|
||||
///
|
||||
/// \param TemplateArgsAsWritten array of location info for the template
|
||||
/// arguments.
|
||||
///
|
||||
/// \param LAngleLoc location of left angle token.
|
||||
///
|
||||
/// \param RAngleLoc location of right angle token.
|
||||
///
|
||||
/// \param PointOfInstantiation point at which the function template
|
||||
/// specialization was first instantiated.
|
||||
void setFunctionTemplateSpecialization(FunctionTemplateDecl *Template,
|
||||
unsigned NumTemplateArgs,
|
||||
const TemplateArgument *TemplateArgs,
|
||||
TemplateSpecializationKind TSK,
|
||||
unsigned NumTemplateArgsAsWritten,
|
||||
TemplateArgumentLoc *TemplateArgsAsWritten,
|
||||
SourceLocation LAngleLoc,
|
||||
SourceLocation RAngleLoc,
|
||||
SourceLocation PointOfInstantiation);
|
||||
|
||||
/// \brief Specifies that this function declaration is actually a
|
||||
/// dependent function template specialization.
|
||||
@ -1493,7 +1623,7 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const FunctionDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= FunctionFirst && K <= FunctionLast;
|
||||
return K >= firstFunction && K <= lastFunction;
|
||||
}
|
||||
static DeclContext *castToDeclContext(const FunctionDecl *D) {
|
||||
return static_cast<DeclContext *>(const_cast<FunctionDecl*>(D));
|
||||
@ -1501,6 +1631,9 @@ public:
|
||||
static FunctionDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<FunctionDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
|
||||
@ -1556,7 +1689,7 @@ public:
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const FieldDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= FieldFirst && K <= FieldLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstField && K <= lastField; }
|
||||
};
|
||||
|
||||
/// EnumConstantDecl - An instance of this object exists for each enum constant
|
||||
@ -1625,7 +1758,7 @@ public:
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const TypeDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= TypeFirst && K <= TypeLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstType && K <= lastType; }
|
||||
};
|
||||
|
||||
|
||||
@ -1715,10 +1848,7 @@ private:
|
||||
|
||||
// A struct representing syntactic qualifier info,
|
||||
// to be used for the (uncommon) case of out-of-line declarations.
|
||||
struct ExtInfo {
|
||||
NestedNameSpecifier *NNS;
|
||||
SourceRange NNSRange;
|
||||
};
|
||||
typedef QualifierInfo ExtInfo;
|
||||
|
||||
/// TypedefDeclOrQualifier - If the (out-of-line) tag declaration name
|
||||
/// is qualified, it points to the qualifier info (nns and range);
|
||||
@ -1767,6 +1897,13 @@ public:
|
||||
SourceLocation getTagKeywordLoc() const { return TagKeywordLoc; }
|
||||
void setTagKeywordLoc(SourceLocation TKL) { TagKeywordLoc = TKL; }
|
||||
|
||||
/// getInnerLocStart - Return SourceLocation representing start of source
|
||||
/// range ignoring outer template declarations.
|
||||
virtual SourceLocation getInnerLocStart() const { return TagKeywordLoc; }
|
||||
|
||||
/// getOuterLocStart - Return SourceLocation representing start of source
|
||||
/// range taking into account any outer template declarations.
|
||||
SourceLocation getOuterLocStart() const;
|
||||
virtual SourceRange getSourceRange() const;
|
||||
|
||||
virtual TagDecl* getCanonicalDecl();
|
||||
@ -1830,24 +1967,34 @@ public:
|
||||
TypedefDecl *getTypedefForAnonDecl() const {
|
||||
return hasExtInfo() ? 0 : TypedefDeclOrQualifier.get<TypedefDecl*>();
|
||||
}
|
||||
|
||||
|
||||
void setTypedefForAnonDecl(TypedefDecl *TDD);
|
||||
|
||||
|
||||
NestedNameSpecifier *getQualifier() const {
|
||||
return hasExtInfo() ? TypedefDeclOrQualifier.get<ExtInfo*>()->NNS : 0;
|
||||
return hasExtInfo() ? getExtInfo()->NNS : 0;
|
||||
}
|
||||
SourceRange getQualifierRange() const {
|
||||
return hasExtInfo()
|
||||
? TypedefDeclOrQualifier.get<ExtInfo*>()->NNSRange
|
||||
: SourceRange();
|
||||
return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange();
|
||||
}
|
||||
void setQualifierInfo(NestedNameSpecifier *Qualifier,
|
||||
SourceRange QualifierRange);
|
||||
|
||||
unsigned getNumTemplateParameterLists() const {
|
||||
return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0;
|
||||
}
|
||||
TemplateParameterList *getTemplateParameterList(unsigned i) const {
|
||||
assert(i < getNumTemplateParameterLists());
|
||||
return getExtInfo()->TemplParamLists[i];
|
||||
}
|
||||
void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists,
|
||||
TemplateParameterList **TPLists) {
|
||||
getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
|
||||
}
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const TagDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K >= TagFirst && K <= TagLast; }
|
||||
static bool classofKind(Kind K) { return K >= firstTag && K <= lastTag; }
|
||||
|
||||
static DeclContext *castToDeclContext(const TagDecl *D) {
|
||||
return static_cast<DeclContext *>(const_cast<TagDecl*>(D));
|
||||
@ -1855,6 +2002,9 @@ public:
|
||||
static TagDecl *castFromDeclContext(const DeclContext *DC) {
|
||||
return static_cast<TagDecl *>(const_cast<DeclContext*>(DC));
|
||||
}
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// EnumDecl - Represents an enum. As an extension, we allow forward-declared
|
||||
@ -1896,9 +2046,17 @@ public:
|
||||
return cast<EnumDecl>(TagDecl::getCanonicalDecl());
|
||||
}
|
||||
|
||||
const EnumDecl *getPreviousDeclaration() const {
|
||||
return cast_or_null<EnumDecl>(TagDecl::getPreviousDeclaration());
|
||||
}
|
||||
EnumDecl *getPreviousDeclaration() {
|
||||
return cast_or_null<EnumDecl>(TagDecl::getPreviousDeclaration());
|
||||
}
|
||||
|
||||
static EnumDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, IdentifierInfo *Id,
|
||||
SourceLocation TKL, EnumDecl *PrevDecl);
|
||||
static EnumDecl *Create(ASTContext &C, EmptyShell Empty);
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
@ -1917,11 +2075,17 @@ public:
|
||||
typedef specific_decl_iterator<EnumConstantDecl> enumerator_iterator;
|
||||
|
||||
enumerator_iterator enumerator_begin() const {
|
||||
return enumerator_iterator(this->decls_begin());
|
||||
const EnumDecl *E = cast_or_null<EnumDecl>(getDefinition());
|
||||
if (!E)
|
||||
E = this;
|
||||
return enumerator_iterator(E->decls_begin());
|
||||
}
|
||||
|
||||
enumerator_iterator enumerator_end() const {
|
||||
return enumerator_iterator(this->decls_end());
|
||||
const EnumDecl *E = cast_or_null<EnumDecl>(getDefinition());
|
||||
if (!E)
|
||||
E = this;
|
||||
return enumerator_iterator(E->decls_end());
|
||||
}
|
||||
|
||||
/// getPromotionType - Return the integer type that enumerators
|
||||
@ -2010,6 +2174,14 @@ public:
|
||||
SourceLocation L, IdentifierInfo *Id,
|
||||
SourceLocation TKL = SourceLocation(),
|
||||
RecordDecl* PrevDecl = 0);
|
||||
static RecordDecl *Create(ASTContext &C, EmptyShell Empty);
|
||||
|
||||
const RecordDecl *getPreviousDeclaration() const {
|
||||
return cast_or_null<RecordDecl>(TagDecl::getPreviousDeclaration());
|
||||
}
|
||||
RecordDecl *getPreviousDeclaration() {
|
||||
return cast_or_null<RecordDecl>(TagDecl::getPreviousDeclaration());
|
||||
}
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
@ -2092,7 +2264,7 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const RecordDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= RecordFirst && K <= RecordLast;
|
||||
return K >= firstRecord && K <= lastRecord;
|
||||
}
|
||||
};
|
||||
|
||||
@ -2127,11 +2299,13 @@ class BlockDecl : public Decl, public DeclContext {
|
||||
unsigned NumParams;
|
||||
|
||||
Stmt *Body;
|
||||
TypeSourceInfo *SignatureAsWritten;
|
||||
|
||||
protected:
|
||||
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
|
||||
: Decl(Block, DC, CaretLoc), DeclContext(Block),
|
||||
IsVariadic(false), ParamInfo(0), NumParams(0), Body(0) {}
|
||||
IsVariadic(false), ParamInfo(0), NumParams(0), Body(0),
|
||||
SignatureAsWritten(0) {}
|
||||
|
||||
virtual ~BlockDecl();
|
||||
virtual void Destroy(ASTContext& C);
|
||||
@ -2148,6 +2322,9 @@ public:
|
||||
Stmt *getBody() const { return (Stmt*) Body; }
|
||||
void setBody(CompoundStmt *B) { Body = (Stmt*) B; }
|
||||
|
||||
void setSignatureAsWritten(TypeSourceInfo *Sig) { SignatureAsWritten = Sig; }
|
||||
TypeSourceInfo *getSignatureAsWritten() const { return SignatureAsWritten; }
|
||||
|
||||
// Iterator access to formal parameters.
|
||||
unsigned param_size() const { return getNumParams(); }
|
||||
typedef ParmVarDecl **param_iterator;
|
||||
|
@ -68,12 +68,13 @@ class Decl {
|
||||
public:
|
||||
/// \brief Lists the kind of concrete classes of Decl.
|
||||
enum Kind {
|
||||
#define DECL(Derived, Base) Derived,
|
||||
#define DECL_RANGE(CommonBase, Start, End) \
|
||||
CommonBase##First = Start, CommonBase##Last = End,
|
||||
#define LAST_DECL_RANGE(CommonBase, Start, End) \
|
||||
CommonBase##First = Start, CommonBase##Last = End
|
||||
#include "clang/AST/DeclNodes.def"
|
||||
#define DECL(DERIVED, BASE) DERIVED,
|
||||
#define ABSTRACT_DECL(DECL)
|
||||
#define DECL_RANGE(BASE, START, END) \
|
||||
first##BASE = START, last##BASE = END,
|
||||
#define LAST_DECL_RANGE(BASE, START, END) \
|
||||
first##BASE = START, last##BASE = END
|
||||
#include "clang/AST/DeclNodes.inc"
|
||||
};
|
||||
|
||||
/// \brief A placeholder type used to construct an empty shell of a
|
||||
@ -244,7 +245,15 @@ protected:
|
||||
HasAttrs(false), Implicit(false), Used(false),
|
||||
Access(AS_none), PCHLevel(0),
|
||||
IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
|
||||
if (Decl::CollectingStats()) addDeclKind(DK);
|
||||
if (Decl::CollectingStats()) add(DK);
|
||||
}
|
||||
|
||||
Decl(Kind DK, EmptyShell Empty)
|
||||
: NextDeclInContext(0), DeclKind(DK), InvalidDecl(0),
|
||||
HasAttrs(false), Implicit(false), Used(false),
|
||||
Access(AS_none), PCHLevel(0),
|
||||
IdentifierNamespace(getIdentifierNamespaceForKind(DK)) {
|
||||
if (Decl::CollectingStats()) add(DK);
|
||||
}
|
||||
|
||||
virtual ~Decl();
|
||||
@ -296,6 +305,7 @@ public:
|
||||
}
|
||||
|
||||
bool hasAttrs() const { return HasAttrs; }
|
||||
void initAttrs(Attr *attrs);
|
||||
void addAttr(Attr *attr);
|
||||
const Attr *getAttrs() const {
|
||||
if (!HasAttrs) return 0; // common case, no attributes.
|
||||
@ -328,7 +338,11 @@ public:
|
||||
|
||||
/// \brief Whether this declaration was used, meaning that a definition
|
||||
/// is required.
|
||||
bool isUsed() const;
|
||||
///
|
||||
/// \param CheckUsedAttr When true, also consider the "used" attribute
|
||||
/// (in addition to the "used" bit set by \c setUsed()) when determining
|
||||
/// whether the function is used.
|
||||
bool isUsed(bool CheckUsedAttr = true) const;
|
||||
|
||||
void setUsed(bool U = true) { Used = U; }
|
||||
|
||||
@ -474,15 +488,16 @@ public:
|
||||
/// top-level Stmt* of that body. Otherwise this method returns null.
|
||||
virtual Stmt* getBody() const { return 0; }
|
||||
|
||||
/// getCompoundBody - Returns getBody(), dyn_casted to a CompoundStmt.
|
||||
CompoundStmt* getCompoundBody() const;
|
||||
/// \brief Returns true if this Decl represents a declaration for a body of
|
||||
/// code, such as a function or method definition.
|
||||
virtual bool hasBody() const { return getBody() != 0; }
|
||||
|
||||
/// getBodyRBrace - Gets the right brace of the body, if a body exists.
|
||||
/// This works whether the body is a CompoundStmt or a CXXTryStmt.
|
||||
SourceLocation getBodyRBrace() const;
|
||||
|
||||
// global temp stats (until we have a per-module visitor)
|
||||
static void addDeclKind(Kind k);
|
||||
static void add(Kind k);
|
||||
static bool CollectingStats(bool Enable = false);
|
||||
static void PrintStats();
|
||||
|
||||
@ -631,6 +646,8 @@ class DeclContext {
|
||||
/// another pointer.
|
||||
mutable Decl *LastDecl;
|
||||
|
||||
friend class ExternalASTSource;
|
||||
|
||||
protected:
|
||||
DeclContext(Decl::Kind K)
|
||||
: DeclKind(K), ExternalLexicalStorage(false),
|
||||
@ -687,7 +704,7 @@ public:
|
||||
case Decl::ObjCMethod:
|
||||
return true;
|
||||
default:
|
||||
return DeclKind >= Decl::FunctionFirst && DeclKind <= Decl::FunctionLast;
|
||||
return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,7 +717,7 @@ public:
|
||||
}
|
||||
|
||||
bool isRecord() const {
|
||||
return DeclKind >= Decl::RecordFirst && DeclKind <= Decl::RecordLast;
|
||||
return DeclKind >= Decl::firstRecord && DeclKind <= Decl::lastRecord;
|
||||
}
|
||||
|
||||
bool isNamespace() const {
|
||||
@ -1083,9 +1100,10 @@ public:
|
||||
|
||||
static bool classof(const Decl *D);
|
||||
static bool classof(const DeclContext *D) { return true; }
|
||||
#define DECL_CONTEXT(Name) \
|
||||
static bool classof(const Name##Decl *D) { return true; }
|
||||
#include "clang/AST/DeclNodes.def"
|
||||
#define DECL(NAME, BASE)
|
||||
#define DECL_CONTEXT(NAME) \
|
||||
static bool classof(const NAME##Decl *D) { return true; }
|
||||
#include "clang/AST/DeclNodes.inc"
|
||||
|
||||
void dumpDeclContext() const;
|
||||
|
||||
|
@ -92,6 +92,53 @@ namespace llvm {
|
||||
|
||||
namespace clang {
|
||||
|
||||
/// AccessSpecDecl - An access specifier followed by colon ':'.
|
||||
///
|
||||
/// An objects of this class represents sugar for the syntactic occurrence
|
||||
/// of an access specifier followed by a colon in the list of member
|
||||
/// specifiers of a C++ class definition.
|
||||
///
|
||||
/// Note that they do not represent other uses of access specifiers,
|
||||
/// such as those occurring in a list of base specifiers.
|
||||
/// Also note that this class has nothing to do with so-called
|
||||
/// "access declarations" (C++98 11.3 [class.access.dcl]).
|
||||
class AccessSpecDecl : public Decl {
|
||||
/// ColonLoc - The location of the ':'.
|
||||
SourceLocation ColonLoc;
|
||||
|
||||
AccessSpecDecl(AccessSpecifier AS, DeclContext *DC,
|
||||
SourceLocation ASLoc, SourceLocation ColonLoc)
|
||||
: Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) {
|
||||
setAccess(AS);
|
||||
}
|
||||
public:
|
||||
/// getAccessSpecifierLoc - The location of the access specifier.
|
||||
SourceLocation getAccessSpecifierLoc() const { return getLocation(); }
|
||||
/// setAccessSpecifierLoc - Sets the location of the access specifier.
|
||||
void setAccessSpecifierLoc(SourceLocation ASLoc) { setLocation(ASLoc); }
|
||||
|
||||
/// getColonLoc - The location of the colon following the access specifier.
|
||||
SourceLocation getColonLoc() const { return ColonLoc; }
|
||||
/// setColonLoc - Sets the location of the colon.
|
||||
void setColonLoc(SourceLocation CLoc) { ColonLoc = CLoc; }
|
||||
|
||||
SourceRange getSourceRange() const {
|
||||
return SourceRange(getAccessSpecifierLoc(), getColonLoc());
|
||||
}
|
||||
|
||||
static AccessSpecDecl *Create(ASTContext &C, AccessSpecifier AS,
|
||||
DeclContext *DC, SourceLocation ASLoc,
|
||||
SourceLocation ColonLoc) {
|
||||
return new (C) AccessSpecDecl(AS, DC, ASLoc, ColonLoc);
|
||||
}
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const AccessSpecDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == AccessSpec; }
|
||||
};
|
||||
|
||||
|
||||
/// CXXBaseSpecifier - A base class of a C++ class.
|
||||
///
|
||||
/// Each CXXBaseSpecifier represents a single, direct base class (or
|
||||
@ -271,7 +318,20 @@ class CXXRecordDecl : public RecordDecl {
|
||||
/// ComputedVisibleConversions - True when visible conversion functions are
|
||||
/// already computed and are available.
|
||||
bool ComputedVisibleConversions : 1;
|
||||
|
||||
|
||||
/// \brief Whether we have already declared the default constructor or
|
||||
/// do not need to have one declared.
|
||||
bool DeclaredDefaultConstructor : 1;
|
||||
|
||||
/// \brief Whether we have already declared the copy constructor.
|
||||
bool DeclaredCopyConstructor : 1;
|
||||
|
||||
/// \brief Whether we have already declared the copy-assignment operator.
|
||||
bool DeclaredCopyAssignment : 1;
|
||||
|
||||
/// \brief Whether we have already declared a destructor within the class.
|
||||
bool DeclaredDestructor : 1;
|
||||
|
||||
/// Bases - Base classes of this class.
|
||||
/// FIXME: This is wasted space for a union.
|
||||
CXXBaseSpecifier *Bases;
|
||||
@ -367,6 +427,13 @@ public:
|
||||
virtual const CXXRecordDecl *getCanonicalDecl() const {
|
||||
return cast<CXXRecordDecl>(RecordDecl::getCanonicalDecl());
|
||||
}
|
||||
|
||||
const CXXRecordDecl *getPreviousDeclaration() const {
|
||||
return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDeclaration());
|
||||
}
|
||||
CXXRecordDecl *getPreviousDeclaration() {
|
||||
return cast_or_null<CXXRecordDecl>(RecordDecl::getPreviousDeclaration());
|
||||
}
|
||||
|
||||
CXXRecordDecl *getDefinition() const {
|
||||
if (!DefinitionData) return 0;
|
||||
@ -380,6 +447,7 @@ public:
|
||||
SourceLocation TKL = SourceLocation(),
|
||||
CXXRecordDecl* PrevDecl=0,
|
||||
bool DelayTypeCreation = false);
|
||||
static CXXRecordDecl *Create(ASTContext &C, EmptyShell Empty);
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
@ -476,6 +544,20 @@ public:
|
||||
return data().FirstFriend != 0;
|
||||
}
|
||||
|
||||
/// \brief Determine whether this class has had its default constructor
|
||||
/// declared implicitly or does not need one declared implicitly.
|
||||
///
|
||||
/// This value is used for lazy creation of default constructors.
|
||||
bool hasDeclaredDefaultConstructor() const {
|
||||
return data().DeclaredDefaultConstructor;
|
||||
}
|
||||
|
||||
/// \brief Note whether this class has already had its default constructor
|
||||
/// implicitly declared or doesn't need one.
|
||||
void setDeclaredDefaultConstructor(bool DDC) {
|
||||
data().DeclaredDefaultConstructor = DDC;
|
||||
}
|
||||
|
||||
/// hasConstCopyConstructor - Determines whether this class has a
|
||||
/// copy constructor that accepts a const-qualified argument.
|
||||
bool hasConstCopyConstructor(ASTContext &Context) const;
|
||||
@ -484,12 +566,18 @@ public:
|
||||
CXXConstructorDecl *getCopyConstructor(ASTContext &Context,
|
||||
unsigned TypeQuals) const;
|
||||
|
||||
/// hasConstCopyAssignment - Determines whether this class has a
|
||||
/// copy assignment operator that accepts a const-qualified argument.
|
||||
/// It returns its decl in MD if found.
|
||||
bool hasConstCopyAssignment(ASTContext &Context,
|
||||
const CXXMethodDecl *&MD) const;
|
||||
|
||||
/// \brief Retrieve the copy-assignment operator for this class, if available.
|
||||
///
|
||||
/// This routine attempts to find the copy-assignment operator for this
|
||||
/// class, using a simplistic form of overload resolution.
|
||||
///
|
||||
/// \param ArgIsConst Whether the argument to the copy-assignment operator
|
||||
/// is const-qualified.
|
||||
///
|
||||
/// \returns The copy-assignment operator that can be invoked, or NULL if
|
||||
/// a unique copy-assignment operator could not be found.
|
||||
CXXMethodDecl *getCopyAssignmentOperator(bool ArgIsConst) const;
|
||||
|
||||
/// addedConstructor - Notify the class that another constructor has
|
||||
/// been added. This routine helps maintain information about the
|
||||
/// class based on which constructors have been added.
|
||||
@ -509,9 +597,23 @@ public:
|
||||
return data().UserDeclaredCopyConstructor;
|
||||
}
|
||||
|
||||
/// \brief Determine whether this class has had its copy constructor
|
||||
/// declared, either via the user or via an implicit declaration.
|
||||
///
|
||||
/// This value is used for lazy creation of copy constructors.
|
||||
bool hasDeclaredCopyConstructor() const {
|
||||
return data().DeclaredCopyConstructor;
|
||||
}
|
||||
|
||||
/// \brief Note whether this class has already had its copy constructor
|
||||
/// declared.
|
||||
void setDeclaredCopyConstructor(bool DCC) {
|
||||
data().DeclaredCopyConstructor = DCC;
|
||||
}
|
||||
|
||||
/// addedAssignmentOperator - Notify the class that another assignment
|
||||
/// operator has been added. This routine helps maintain information about the
|
||||
/// class based on which operators have been added.
|
||||
/// class based on which operators have been added.
|
||||
void addedAssignmentOperator(ASTContext &Context, CXXMethodDecl *OpDecl);
|
||||
|
||||
/// hasUserDeclaredCopyAssignment - Whether this class has a
|
||||
@ -521,6 +623,20 @@ public:
|
||||
return data().UserDeclaredCopyAssignment;
|
||||
}
|
||||
|
||||
/// \brief Determine whether this class has had its copy assignment operator
|
||||
/// declared, either via the user or via an implicit declaration.
|
||||
///
|
||||
/// This value is used for lazy creation of copy assignment operators.
|
||||
bool hasDeclaredCopyAssignment() const {
|
||||
return data().DeclaredCopyAssignment;
|
||||
}
|
||||
|
||||
/// \brief Note whether this class has already had its copy assignment
|
||||
/// operator declared.
|
||||
void setDeclaredCopyAssignment(bool DCA) {
|
||||
data().DeclaredCopyAssignment = DCA;
|
||||
}
|
||||
|
||||
/// hasUserDeclaredDestructor - Whether this class has a
|
||||
/// user-declared destructor. When false, a destructor will be
|
||||
/// implicitly declared.
|
||||
@ -533,8 +649,21 @@ public:
|
||||
/// fully defined, a destructor will be implicitly declared.
|
||||
void setUserDeclaredDestructor(bool UCD) {
|
||||
data().UserDeclaredDestructor = UCD;
|
||||
if (UCD)
|
||||
data().DeclaredDestructor = true;
|
||||
}
|
||||
|
||||
/// \brief Determine whether this class has had its destructor declared,
|
||||
/// either via the user or via an implicit declaration.
|
||||
///
|
||||
/// This value is used for lazy creation of destructors.
|
||||
bool hasDeclaredDestructor() const { return data().DeclaredDestructor; }
|
||||
|
||||
/// \brief Note whether this class has already had its destructor declared.
|
||||
void setDeclaredDestructor(bool DD) {
|
||||
data().DeclaredDestructor = DD;
|
||||
}
|
||||
|
||||
/// getConversions - Retrieve the overload set containing all of the
|
||||
/// conversion functions in this class.
|
||||
UnresolvedSetImpl *getConversionFunctions() {
|
||||
@ -726,10 +855,10 @@ public:
|
||||
void setTemplateSpecializationKind(TemplateSpecializationKind TSK);
|
||||
|
||||
/// getDefaultConstructor - Returns the default constructor for this class
|
||||
CXXConstructorDecl *getDefaultConstructor(ASTContext &Context);
|
||||
CXXConstructorDecl *getDefaultConstructor();
|
||||
|
||||
/// getDestructor - Returns the destructor decl for this class.
|
||||
CXXDestructorDecl *getDestructor(ASTContext &Context) const;
|
||||
CXXDestructorDecl *getDestructor() const;
|
||||
|
||||
/// isLocalClass - If the class is a local class [class.local], returns
|
||||
/// the enclosing function declaration.
|
||||
@ -920,14 +1049,15 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classofKind(Kind K) {
|
||||
return K == CXXRecord ||
|
||||
K == ClassTemplateSpecialization ||
|
||||
K == ClassTemplatePartialSpecialization;
|
||||
return K >= firstCXXRecord && K <= lastCXXRecord;
|
||||
}
|
||||
static bool classof(const CXXRecordDecl *D) { return true; }
|
||||
static bool classof(const ClassTemplateSpecializationDecl *D) {
|
||||
return true;
|
||||
}
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// CXXMethodDecl - Represents a static or instance method of a
|
||||
@ -984,6 +1114,7 @@ public:
|
||||
|
||||
method_iterator begin_overridden_methods() const;
|
||||
method_iterator end_overridden_methods() const;
|
||||
unsigned size_overridden_methods() const;
|
||||
|
||||
/// getParent - Returns the parent of this method declaration, which
|
||||
/// is the class in which this method is defined.
|
||||
@ -1012,7 +1143,7 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const CXXMethodDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= CXXMethod && K <= CXXConversion;
|
||||
return K >= firstCXXMethod && K <= lastCXXMethod;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1387,6 +1518,9 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const CXXConstructorDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == CXXConstructor; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// CXXDestructorDecl - Represents a C++ destructor within a
|
||||
@ -1450,6 +1584,9 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const CXXDestructorDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == CXXDestructor; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// CXXConversionDecl - Represents a C++ conversion function within a
|
||||
@ -1504,6 +1641,9 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const CXXConversionDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == CXXConversion; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// LinkageSpecDecl - This represents a linkage specification. For example:
|
||||
@ -1607,7 +1747,7 @@ class UsingDirectiveDecl : public NamedDecl {
|
||||
SourceLocation IdentLoc,
|
||||
NamedDecl *Nominated,
|
||||
DeclContext *CommonAncestor)
|
||||
: NamedDecl(Decl::UsingDirective, DC, L, getName()),
|
||||
: NamedDecl(UsingDirective, DC, L, getName()),
|
||||
NamespaceLoc(NamespcLoc), QualifierRange(QualifierRange),
|
||||
Qualifier(Qualifier), IdentLoc(IdentLoc),
|
||||
NominatedNamespace(Nominated),
|
||||
@ -1680,7 +1820,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const UsingDirectiveDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::UsingDirective; }
|
||||
static bool classofKind(Kind K) { return K == UsingDirective; }
|
||||
|
||||
// Friend for getUsingDirectiveName.
|
||||
friend class DeclContext;
|
||||
@ -1714,7 +1854,7 @@ class NamespaceAliasDecl : public NamedDecl {
|
||||
SourceRange QualifierRange,
|
||||
NestedNameSpecifier *Qualifier,
|
||||
SourceLocation IdentLoc, NamedDecl *Namespace)
|
||||
: NamedDecl(Decl::NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
|
||||
: NamedDecl(NamespaceAlias, DC, L, Alias), AliasLoc(AliasLoc),
|
||||
QualifierRange(QualifierRange), Qualifier(Qualifier),
|
||||
IdentLoc(IdentLoc), Namespace(Namespace) { }
|
||||
|
||||
@ -1786,7 +1926,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const NamespaceAliasDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::NamespaceAlias; }
|
||||
static bool classofKind(Kind K) { return K == NamespaceAlias; }
|
||||
};
|
||||
|
||||
/// UsingShadowDecl - Represents a shadow declaration introduced into
|
||||
@ -1809,9 +1949,12 @@ class UsingShadowDecl : public NamedDecl {
|
||||
|
||||
UsingShadowDecl(DeclContext *DC, SourceLocation Loc, UsingDecl *Using,
|
||||
NamedDecl *Target)
|
||||
: NamedDecl(UsingShadow, DC, Loc, Target->getDeclName()),
|
||||
: NamedDecl(UsingShadow, DC, Loc, DeclarationName()),
|
||||
Underlying(Target), Using(Using) {
|
||||
IdentifierNamespace = Target->getIdentifierNamespace();
|
||||
if (Target) {
|
||||
setDeclName(Target->getDeclName());
|
||||
IdentifierNamespace = Target->getIdentifierNamespace();
|
||||
}
|
||||
setImplicit();
|
||||
}
|
||||
|
||||
@ -1828,7 +1971,11 @@ public:
|
||||
|
||||
/// \brief Sets the underlying declaration which has been brought into the
|
||||
/// local scope.
|
||||
void setTargetDecl(NamedDecl* ND) { Underlying = ND; }
|
||||
void setTargetDecl(NamedDecl* ND) {
|
||||
assert(ND && "Target decl is null!");
|
||||
Underlying = ND;
|
||||
IdentifierNamespace = ND->getIdentifierNamespace();
|
||||
}
|
||||
|
||||
/// \brief Gets the using declaration to which this declaration is tied.
|
||||
UsingDecl *getUsingDecl() const { return Using; }
|
||||
@ -1866,7 +2013,7 @@ class UsingDecl : public NamedDecl {
|
||||
UsingDecl(DeclContext *DC, SourceLocation L, SourceRange NNR,
|
||||
SourceLocation UL, NestedNameSpecifier* TargetNNS,
|
||||
DeclarationName Name, bool IsTypeNameArg)
|
||||
: NamedDecl(Decl::Using, DC, L, Name),
|
||||
: NamedDecl(Using, DC, L, Name),
|
||||
NestedNameRange(NNR), UsingLocation(UL), TargetNestedName(TargetNNS),
|
||||
IsTypeName(IsTypeNameArg) {
|
||||
}
|
||||
@ -1934,7 +2081,10 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const UsingDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::Using; }
|
||||
static bool classofKind(Kind K) { return K == Using; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// UnresolvedUsingValueDecl - Represents a dependent using
|
||||
@ -1960,7 +2110,7 @@ class UnresolvedUsingValueDecl : public ValueDecl {
|
||||
NestedNameSpecifier *TargetNNS,
|
||||
SourceLocation TargetNameLoc,
|
||||
DeclarationName TargetName)
|
||||
: ValueDecl(Decl::UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
|
||||
: ValueDecl(UnresolvedUsingValue, DC, TargetNameLoc, TargetName, Ty),
|
||||
TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
|
||||
TargetNestedNameSpecifier(TargetNNS)
|
||||
{ }
|
||||
@ -1997,7 +2147,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const UnresolvedUsingValueDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingValue; }
|
||||
static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
|
||||
};
|
||||
|
||||
/// UnresolvedUsingTypenameDecl - Represents a dependent using
|
||||
@ -2026,7 +2176,7 @@ class UnresolvedUsingTypenameDecl : public TypeDecl {
|
||||
SourceLocation TypenameLoc,
|
||||
SourceRange TargetNNR, NestedNameSpecifier *TargetNNS,
|
||||
SourceLocation TargetNameLoc, IdentifierInfo *TargetName)
|
||||
: TypeDecl(Decl::UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
|
||||
: TypeDecl(UnresolvedUsingTypename, DC, TargetNameLoc, TargetName),
|
||||
TargetNestedNameRange(TargetNNR), UsingLocation(UsingLoc),
|
||||
TypenameLocation(TypenameLoc), TargetNestedNameSpecifier(TargetNNS)
|
||||
{ }
|
||||
@ -2070,7 +2220,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const UnresolvedUsingTypenameDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::UnresolvedUsingTypename; }
|
||||
static bool classofKind(Kind K) { return K == UnresolvedUsingTypename; }
|
||||
};
|
||||
|
||||
/// StaticAssertDecl - Represents a C++0x static_assert declaration.
|
||||
@ -2098,7 +2248,7 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(StaticAssertDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::StaticAssert; }
|
||||
static bool classofKind(Kind K) { return K == StaticAssert; }
|
||||
};
|
||||
|
||||
/// Insertion operator for diagnostics. This allows sending AccessSpecifier's
|
||||
|
@ -59,10 +59,14 @@ private:
|
||||
FriendLoc(FriendL) {
|
||||
}
|
||||
|
||||
explicit FriendDecl(EmptyShell Empty)
|
||||
: Decl(Decl::Friend, Empty), NextFriend(0) { }
|
||||
|
||||
public:
|
||||
static FriendDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, FriendUnion Friend_,
|
||||
SourceLocation FriendL);
|
||||
static FriendDecl *Create(ASTContext &C, EmptyShell Empty);
|
||||
|
||||
/// If this friend declaration names an (untemplated but
|
||||
/// possibly dependent) type, return the type; otherwise
|
||||
@ -87,6 +91,9 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const FriendDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == Decl::Friend; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// An iterator over the friend declarations of a class.
|
||||
|
@ -239,6 +239,12 @@ public:
|
||||
QualType getResultType() const { return MethodDeclType; }
|
||||
void setResultType(QualType T) { MethodDeclType = T; }
|
||||
|
||||
/// \brief Determine the type of an expression that sends a message to this
|
||||
/// function.
|
||||
QualType getSendResultType() const {
|
||||
return getResultType().getCallResultType(getASTContext());
|
||||
}
|
||||
|
||||
TypeSourceInfo *getResultTypeSourceInfo() const { return ResultTInfo; }
|
||||
void setResultTypeSourceInfo(TypeSourceInfo *TInfo) { ResultTInfo = TInfo; }
|
||||
|
||||
@ -417,8 +423,8 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const ObjCContainerDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= ObjCContainerFirst &&
|
||||
K <= ObjCContainerLast;
|
||||
return K >= firstObjCContainer &&
|
||||
K <= lastObjCContainer;
|
||||
}
|
||||
|
||||
static DeclContext *castToDeclContext(const ObjCContainerDecl *D) {
|
||||
@ -550,8 +556,8 @@ public:
|
||||
void setCategoryList(ObjCCategoryDecl *category) {
|
||||
CategoryList = category;
|
||||
}
|
||||
|
||||
ObjCCategoryDecl* getClassExtension() const;
|
||||
|
||||
ObjCCategoryDecl* getFirstClassExtension() const;
|
||||
|
||||
ObjCPropertyDecl
|
||||
*FindPropertyVisibleInPrimaryClass(IdentifierInfo *PropertyId) const;
|
||||
@ -983,6 +989,7 @@ public:
|
||||
}
|
||||
|
||||
bool IsClassExtension() const { return getIdentifier() == 0; }
|
||||
const ObjCCategoryDecl *getNextClassExtension() const;
|
||||
|
||||
typedef specific_decl_iterator<ObjCIvarDecl> ivar_iterator;
|
||||
ivar_iterator ivar_begin() const {
|
||||
@ -1059,7 +1066,7 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const ObjCImplDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= ObjCImplFirst && K <= ObjCImplLast;
|
||||
return K >= firstObjCImpl && K <= lastObjCImpl;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1306,9 +1313,9 @@ public:
|
||||
enum PropertyControl { None, Required, Optional };
|
||||
private:
|
||||
SourceLocation AtLoc; // location of @property
|
||||
QualType DeclType;
|
||||
TypeSourceInfo *DeclType;
|
||||
unsigned PropertyAttributes : 8;
|
||||
|
||||
unsigned PropertyAttributesAsWritten : 8;
|
||||
// @required/@optional
|
||||
unsigned PropertyImplementation : 2;
|
||||
|
||||
@ -1320,9 +1327,11 @@ private:
|
||||
ObjCIvarDecl *PropertyIvarDecl; // Synthesize ivar for this property
|
||||
|
||||
ObjCPropertyDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
|
||||
SourceLocation AtLocation, QualType T)
|
||||
SourceLocation AtLocation, TypeSourceInfo *T)
|
||||
: NamedDecl(ObjCProperty, DC, L, Id), AtLoc(AtLocation), DeclType(T),
|
||||
PropertyAttributes(OBJC_PR_noattr), PropertyImplementation(None),
|
||||
PropertyAttributes(OBJC_PR_noattr),
|
||||
PropertyAttributesAsWritten(OBJC_PR_noattr),
|
||||
PropertyImplementation(None),
|
||||
GetterName(Selector()),
|
||||
SetterName(Selector()),
|
||||
GetterMethodDecl(0), SetterMethodDecl(0) , PropertyIvarDecl(0) {}
|
||||
@ -1330,13 +1339,14 @@ public:
|
||||
static ObjCPropertyDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
IdentifierInfo *Id, SourceLocation AtLocation,
|
||||
QualType T,
|
||||
TypeSourceInfo *T,
|
||||
PropertyControl propControl = None);
|
||||
SourceLocation getAtLoc() const { return AtLoc; }
|
||||
void setAtLoc(SourceLocation L) { AtLoc = L; }
|
||||
|
||||
QualType getType() const { return DeclType; }
|
||||
void setType(QualType T) { DeclType = T; }
|
||||
TypeSourceInfo *getTypeSourceInfo() const { return DeclType; }
|
||||
QualType getType() const { return DeclType->getType(); }
|
||||
void setType(TypeSourceInfo *T) { DeclType = T; }
|
||||
|
||||
PropertyAttributeKind getPropertyAttributes() const {
|
||||
return PropertyAttributeKind(PropertyAttributes);
|
||||
@ -1345,6 +1355,14 @@ public:
|
||||
PropertyAttributes |= PRVal;
|
||||
}
|
||||
|
||||
PropertyAttributeKind getPropertyAttributesAsWritten() const {
|
||||
return PropertyAttributeKind(PropertyAttributesAsWritten);
|
||||
}
|
||||
|
||||
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal) {
|
||||
PropertyAttributesAsWritten = PRVal;
|
||||
}
|
||||
|
||||
void makeitReadWriteAttribute(void) {
|
||||
PropertyAttributes &= ~OBJC_PR_readonly;
|
||||
PropertyAttributes |= OBJC_PR_readwrite;
|
||||
|
@ -180,18 +180,29 @@ public:
|
||||
TemplateArgumentListBuilder &Builder,
|
||||
bool TakeArgs);
|
||||
|
||||
/// TemplateArgumentList - It copies the template arguments into a locally
|
||||
/// new[]'d array.
|
||||
TemplateArgumentList(ASTContext &Context,
|
||||
const TemplateArgument *Args, unsigned NumArgs);
|
||||
|
||||
/// Produces a shallow copy of the given template argument list. This
|
||||
/// assumes that the input argument list outlives it. This takes the list as
|
||||
/// a pointer to avoid looking like a copy constructor, since this really
|
||||
/// really isn't safe to use that way.
|
||||
explicit TemplateArgumentList(const TemplateArgumentList *Other);
|
||||
|
||||
|
||||
TemplateArgumentList() : NumFlatArguments(0), NumStructuredArguments(0) { }
|
||||
|
||||
/// Used to release the memory associated with a TemplateArgumentList
|
||||
/// object. FIXME: This is currently not called anywhere, but the
|
||||
/// memory will still be freed when using a BumpPtrAllocator.
|
||||
void Destroy(ASTContext &C);
|
||||
|
||||
~TemplateArgumentList();
|
||||
|
||||
/// \brief Copies the template arguments into a locally new[]'d array.
|
||||
void init(ASTContext &Context,
|
||||
const TemplateArgument *Args, unsigned NumArgs);
|
||||
|
||||
/// \brief Retrieve the template argument at a given index.
|
||||
const TemplateArgument &get(unsigned Idx) const {
|
||||
@ -261,12 +272,27 @@ public:
|
||||
static bool classof(const ClassTemplateDecl *D) { return true; }
|
||||
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) {
|
||||
return K >= TemplateFirst && K <= TemplateLast;
|
||||
return K >= firstTemplate && K <= lastTemplate;
|
||||
}
|
||||
|
||||
SourceRange getSourceRange() const {
|
||||
return SourceRange(TemplateParams->getTemplateLoc(),
|
||||
TemplatedDecl->getSourceRange().getEnd());
|
||||
}
|
||||
|
||||
protected:
|
||||
NamedDecl *TemplatedDecl;
|
||||
TemplateParameterList* TemplateParams;
|
||||
|
||||
public:
|
||||
/// \brief Initialize the underlying templated declaration and
|
||||
/// template parameters.
|
||||
void init(NamedDecl *templatedDecl, TemplateParameterList* templateParams) {
|
||||
assert(TemplatedDecl == 0 && "TemplatedDecl already set!");
|
||||
assert(TemplateParams == 0 && "TemplateParams already set!");
|
||||
TemplatedDecl = templatedDecl;
|
||||
TemplateParams = templateParams;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Provides information about a function template specialization,
|
||||
@ -353,8 +379,9 @@ class MemberSpecializationInfo {
|
||||
|
||||
public:
|
||||
explicit
|
||||
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK)
|
||||
: MemberAndTSK(IF, TSK - 1), PointOfInstantiation() {
|
||||
MemberSpecializationInfo(NamedDecl *IF, TemplateSpecializationKind TSK,
|
||||
SourceLocation POI = SourceLocation())
|
||||
: MemberAndTSK(IF, TSK - 1), PointOfInstantiation(POI) {
|
||||
assert(TSK != TSK_Undeclared &&
|
||||
"Cannot encode undeclared template specializations for members");
|
||||
}
|
||||
@ -602,6 +629,9 @@ public:
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const FunctionTemplateDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == FunctionTemplate; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -634,9 +664,11 @@ protected:
|
||||
public:
|
||||
/// Get the nesting depth of the template parameter.
|
||||
unsigned getDepth() const { return Depth; }
|
||||
void setDepth(unsigned D) { Depth = D; }
|
||||
|
||||
/// Get the position of the template parameter within its parameter list.
|
||||
unsigned getPosition() const { return Position; }
|
||||
void setPosition(unsigned P) { Position = P; }
|
||||
|
||||
/// Get the index of the template parameter within its parameter list.
|
||||
unsigned getIndex() const { return Position; }
|
||||
@ -675,6 +707,7 @@ public:
|
||||
SourceLocation L, unsigned D, unsigned P,
|
||||
IdentifierInfo *Id, bool Typename,
|
||||
bool ParameterPack);
|
||||
static TemplateTypeParmDecl *Create(ASTContext &C, EmptyShell Empty);
|
||||
|
||||
/// \brief Whether this template type parameter was declared with
|
||||
/// the 'typename' keyword. If not, it was declared with the 'class'
|
||||
@ -711,6 +744,13 @@ public:
|
||||
DefaultArgument = 0;
|
||||
InheritedDefault = false;
|
||||
}
|
||||
|
||||
/// \brief Set whether this template type parameter was declared with
|
||||
/// the 'typename' or 'class' keyword.
|
||||
void setDeclaredWithTypename(bool withTypename) { Typename = withTypename; }
|
||||
|
||||
/// \brief Set whether this is a parameter pack.
|
||||
void setParameterPack(bool isParamPack) { ParameterPack = isParamPack; }
|
||||
|
||||
/// \brief Retrieve the depth of the template parameter.
|
||||
unsigned getDepth() const;
|
||||
@ -734,15 +774,16 @@ public:
|
||||
/// @endcode
|
||||
class NonTypeTemplateParmDecl
|
||||
: public VarDecl, protected TemplateParmPosition {
|
||||
/// \brief The default template argument, if any.
|
||||
Expr *DefaultArgument;
|
||||
/// \brief The default template argument, if any, and whether or not
|
||||
/// it was inherited.
|
||||
llvm::PointerIntPair<Expr*, 1, bool> DefaultArgumentAndInherited;
|
||||
|
||||
NonTypeTemplateParmDecl(DeclContext *DC, SourceLocation L, unsigned D,
|
||||
unsigned P, IdentifierInfo *Id, QualType T,
|
||||
TypeSourceInfo *TInfo)
|
||||
: VarDecl(NonTypeTemplateParm, DC, L, Id, T, TInfo, VarDecl::None,
|
||||
VarDecl::None),
|
||||
TemplateParmPosition(D, P), DefaultArgument(0)
|
||||
TemplateParmPosition(D, P), DefaultArgumentAndInherited(0, false)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -751,22 +792,43 @@ public:
|
||||
unsigned P, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo);
|
||||
|
||||
using TemplateParmPosition::getDepth;
|
||||
using TemplateParmPosition::setDepth;
|
||||
using TemplateParmPosition::getPosition;
|
||||
using TemplateParmPosition::setPosition;
|
||||
using TemplateParmPosition::getIndex;
|
||||
|
||||
/// \brief Determine whether this template parameter has a default
|
||||
/// argument.
|
||||
bool hasDefaultArgument() const { return DefaultArgument; }
|
||||
bool hasDefaultArgument() const {
|
||||
return DefaultArgumentAndInherited.getPointer() != 0;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the default argument, if any.
|
||||
Expr *getDefaultArgument() const { return DefaultArgument; }
|
||||
Expr *getDefaultArgument() const {
|
||||
return DefaultArgumentAndInherited.getPointer();
|
||||
}
|
||||
|
||||
/// \brief Retrieve the location of the default argument, if any.
|
||||
SourceLocation getDefaultArgumentLoc() const;
|
||||
|
||||
/// \brief Set the default argument for this template parameter.
|
||||
void setDefaultArgument(Expr *DefArg) {
|
||||
DefaultArgument = DefArg;
|
||||
/// \brief Determines whether the default argument was inherited
|
||||
/// from a previous declaration of this template.
|
||||
bool defaultArgumentWasInherited() const {
|
||||
return DefaultArgumentAndInherited.getInt();
|
||||
}
|
||||
|
||||
/// \brief Set the default argument for this template parameter, and
|
||||
/// whether that default argument was inherited from another
|
||||
/// declaration.
|
||||
void setDefaultArgument(Expr *DefArg, bool Inherited) {
|
||||
DefaultArgumentAndInherited.setPointer(DefArg);
|
||||
DefaultArgumentAndInherited.setInt(Inherited);
|
||||
}
|
||||
|
||||
/// \brief Removes the default argument of this template parameter.
|
||||
void removeDefaultArgument() {
|
||||
DefaultArgumentAndInherited.setPointer(0);
|
||||
DefaultArgumentAndInherited.setInt(false);
|
||||
}
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
@ -785,14 +847,17 @@ public:
|
||||
class TemplateTemplateParmDecl
|
||||
: public TemplateDecl, protected TemplateParmPosition {
|
||||
|
||||
/// \brief The default template argument, if any.
|
||||
/// DefaultArgument - The default template argument, if any.
|
||||
TemplateArgumentLoc DefaultArgument;
|
||||
/// Whether or not the default argument was inherited.
|
||||
bool DefaultArgumentWasInherited;
|
||||
|
||||
TemplateTemplateParmDecl(DeclContext *DC, SourceLocation L,
|
||||
unsigned D, unsigned P,
|
||||
IdentifierInfo *Id, TemplateParameterList *Params)
|
||||
: TemplateDecl(TemplateTemplateParm, DC, L, Id, Params),
|
||||
TemplateParmPosition(D, P), DefaultArgument()
|
||||
TemplateParmPosition(D, P), DefaultArgument(),
|
||||
DefaultArgumentWasInherited(false)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -807,24 +872,45 @@ public:
|
||||
|
||||
/// \brief Determine whether this template parameter has a default
|
||||
/// argument.
|
||||
bool hasDefaultArgument() const {
|
||||
return !DefaultArgument.getArgument().isNull();
|
||||
bool hasDefaultArgument() const {
|
||||
return !DefaultArgument.getArgument().isNull();
|
||||
}
|
||||
|
||||
/// \brief Retrieve the default argument, if any.
|
||||
const TemplateArgumentLoc &getDefaultArgument() const {
|
||||
return DefaultArgument;
|
||||
const TemplateArgumentLoc &getDefaultArgument() const {
|
||||
return DefaultArgument;
|
||||
}
|
||||
|
||||
/// \brief Set the default argument for this template parameter.
|
||||
void setDefaultArgument(const TemplateArgumentLoc &DefArg) {
|
||||
/// \brief Retrieve the location of the default argument, if any.
|
||||
SourceLocation getDefaultArgumentLoc() const;
|
||||
|
||||
/// \brief Determines whether the default argument was inherited
|
||||
/// from a previous declaration of this template.
|
||||
bool defaultArgumentWasInherited() const {
|
||||
return DefaultArgumentWasInherited;
|
||||
}
|
||||
|
||||
/// \brief Set the default argument for this template parameter, and
|
||||
/// whether that default argument was inherited from another
|
||||
/// declaration.
|
||||
void setDefaultArgument(const TemplateArgumentLoc &DefArg, bool Inherited) {
|
||||
DefaultArgument = DefArg;
|
||||
DefaultArgumentWasInherited = Inherited;
|
||||
}
|
||||
|
||||
/// \brief Removes the default argument of this template parameter.
|
||||
void removeDefaultArgument() {
|
||||
DefaultArgument = TemplateArgumentLoc();
|
||||
DefaultArgumentWasInherited = false;
|
||||
}
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const TemplateTemplateParmDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == TemplateTemplateParm; }
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// \brief Represents a class template specialization, which refers to
|
||||
@ -860,9 +946,22 @@ class ClassTemplateSpecializationDecl
|
||||
llvm::PointerUnion<ClassTemplateDecl *, SpecializedPartialSpecialization *>
|
||||
SpecializedTemplate;
|
||||
|
||||
/// \brief The type-as-written of an explicit template specialization.
|
||||
/// \brief Further info for explicit template specialization/instantiation.
|
||||
struct ExplicitSpecializationInfo {
|
||||
/// \brief The type-as-written.
|
||||
TypeSourceInfo *TypeAsWritten;
|
||||
/// \brief The location of the extern keyword.
|
||||
SourceLocation ExternLoc;
|
||||
/// \brief The location of the template keyword.
|
||||
SourceLocation TemplateKeywordLoc;
|
||||
|
||||
ExplicitSpecializationInfo()
|
||||
: TypeAsWritten(0), ExternLoc(), TemplateKeywordLoc() {}
|
||||
};
|
||||
|
||||
/// \brief Further info for explicit template specialization/instantiation.
|
||||
/// Does not apply to implicit specializations.
|
||||
TypeSourceInfo *TypeAsWritten;
|
||||
ExplicitSpecializationInfo *ExplicitInfo;
|
||||
|
||||
/// \brief The template arguments used to describe this specialization.
|
||||
TemplateArgumentList TemplateArgs;
|
||||
@ -881,12 +980,16 @@ protected:
|
||||
TemplateArgumentListBuilder &Builder,
|
||||
ClassTemplateSpecializationDecl *PrevDecl);
|
||||
|
||||
explicit ClassTemplateSpecializationDecl(Kind DK);
|
||||
|
||||
public:
|
||||
static ClassTemplateSpecializationDecl *
|
||||
Create(ASTContext &Context, TagKind TK, DeclContext *DC, SourceLocation L,
|
||||
ClassTemplateDecl *SpecializedTemplate,
|
||||
TemplateArgumentListBuilder &Builder,
|
||||
ClassTemplateSpecializationDecl *PrevDecl);
|
||||
static ClassTemplateSpecializationDecl *
|
||||
Create(ASTContext &Context, EmptyShell Empty);
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
@ -903,6 +1006,14 @@ public:
|
||||
return TemplateArgs;
|
||||
}
|
||||
|
||||
/// \brief Initialize the template arguments of the class template
|
||||
/// specialization.
|
||||
void initTemplateArgs(TemplateArgument *Args, unsigned NumArgs) {
|
||||
assert(TemplateArgs.flat_size() == 0 &&
|
||||
"Template arguments already initialized!");
|
||||
TemplateArgs.init(getASTContext(), Args, NumArgs);
|
||||
}
|
||||
|
||||
/// \brief Determine the kind of specialization that this
|
||||
/// declaration represents.
|
||||
TemplateSpecializationKind getSpecializationKind() const {
|
||||
@ -943,6 +1054,19 @@ public:
|
||||
SpecializedTemplate.get<ClassTemplateDecl*>());
|
||||
}
|
||||
|
||||
/// \brief Retrieve the class template or class template partial
|
||||
/// specialization which was specialized by this.
|
||||
llvm::PointerUnion<ClassTemplateDecl *,
|
||||
ClassTemplatePartialSpecializationDecl *>
|
||||
getSpecializedTemplateOrPartial() const {
|
||||
if (SpecializedPartialSpecialization *PartialSpec
|
||||
= SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
|
||||
return PartialSpec->PartialSpecialization;
|
||||
|
||||
return const_cast<ClassTemplateDecl*>(
|
||||
SpecializedTemplate.get<ClassTemplateDecl*>());
|
||||
}
|
||||
|
||||
/// \brief Retrieve the set of template arguments that should be used
|
||||
/// to instantiate members of the class template or class template partial
|
||||
/// specialization from which this class template specialization was
|
||||
@ -967,6 +1091,8 @@ public:
|
||||
/// template arguments have been deduced.
|
||||
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
|
||||
TemplateArgumentList *TemplateArgs) {
|
||||
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
|
||||
"Already set to a class template partial specialization!");
|
||||
SpecializedPartialSpecialization *PS
|
||||
= new (getASTContext()) SpecializedPartialSpecialization();
|
||||
PS->PartialSpecialization = PartialSpec;
|
||||
@ -974,18 +1100,60 @@ public:
|
||||
SpecializedTemplate = PS;
|
||||
}
|
||||
|
||||
/// \brief Note that this class template specialization is actually an
|
||||
/// instantiation of the given class template partial specialization whose
|
||||
/// template arguments have been deduced.
|
||||
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec,
|
||||
TemplateArgument *TemplateArgs,
|
||||
unsigned NumTemplateArgs) {
|
||||
ASTContext &Ctx = getASTContext();
|
||||
setInstantiationOf(PartialSpec,
|
||||
new (Ctx) TemplateArgumentList(Ctx, TemplateArgs,
|
||||
NumTemplateArgs));
|
||||
}
|
||||
|
||||
/// \brief Note that this class template specialization is an instantiation
|
||||
/// of the given class template.
|
||||
void setInstantiationOf(ClassTemplateDecl *TemplDecl) {
|
||||
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
|
||||
"Previously set to a class template partial specialization!");
|
||||
SpecializedTemplate = TemplDecl;
|
||||
}
|
||||
|
||||
/// \brief Sets the type of this specialization as it was written by
|
||||
/// the user. This will be a class template specialization type.
|
||||
void setTypeAsWritten(TypeSourceInfo *T) {
|
||||
TypeAsWritten = T;
|
||||
if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
|
||||
ExplicitInfo->TypeAsWritten = T;
|
||||
}
|
||||
|
||||
/// \brief Gets the type of this specialization as it was written by
|
||||
/// the user, if it was so written.
|
||||
TypeSourceInfo *getTypeAsWritten() const {
|
||||
return TypeAsWritten;
|
||||
return ExplicitInfo ? ExplicitInfo->TypeAsWritten : 0;
|
||||
}
|
||||
|
||||
/// \brief Gets the location of the extern keyword, if present.
|
||||
SourceLocation getExternLoc() const {
|
||||
return ExplicitInfo ? ExplicitInfo->ExternLoc : SourceLocation();
|
||||
}
|
||||
/// \brief Sets the location of the extern keyword.
|
||||
void setExternLoc(SourceLocation Loc) {
|
||||
if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
|
||||
ExplicitInfo->ExternLoc = Loc;
|
||||
}
|
||||
|
||||
/// \brief Sets the location of the template keyword.
|
||||
void setTemplateKeywordLoc(SourceLocation Loc) {
|
||||
if (!ExplicitInfo) ExplicitInfo = new ExplicitSpecializationInfo;
|
||||
ExplicitInfo->TemplateKeywordLoc = Loc;
|
||||
}
|
||||
/// \brief Gets the location of the template keyword, if present.
|
||||
SourceLocation getTemplateKeywordLoc() const {
|
||||
return ExplicitInfo ? ExplicitInfo->TemplateKeywordLoc : SourceLocation();
|
||||
}
|
||||
|
||||
SourceLocation getInnerLocStart() const { return getTemplateKeywordLoc(); }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const {
|
||||
Profile(ID, TemplateArgs.getFlatArgumentList(), TemplateArgs.flat_size(),
|
||||
getASTContext());
|
||||
@ -1001,8 +1169,8 @@ public:
|
||||
|
||||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classofKind(Kind K) {
|
||||
return K == ClassTemplateSpecialization ||
|
||||
K == ClassTemplatePartialSpecialization;
|
||||
return K >= firstClassTemplateSpecialization &&
|
||||
K <= lastClassTemplateSpecialization;
|
||||
}
|
||||
|
||||
static bool classof(const ClassTemplateSpecializationDecl *) {
|
||||
@ -1053,6 +1221,12 @@ class ClassTemplatePartialSpecializationDecl
|
||||
TemplateParams(Params), ArgsAsWritten(ArgInfos),
|
||||
NumArgsAsWritten(NumArgInfos), SequenceNumber(SequenceNumber),
|
||||
InstantiatedFromMember(0, false) { }
|
||||
|
||||
ClassTemplatePartialSpecializationDecl()
|
||||
: ClassTemplateSpecializationDecl(ClassTemplatePartialSpecialization),
|
||||
TemplateParams(0), ArgsAsWritten(0),
|
||||
NumArgsAsWritten(0), SequenceNumber(0),
|
||||
InstantiatedFromMember(0, false) { }
|
||||
|
||||
public:
|
||||
static ClassTemplatePartialSpecializationDecl *
|
||||
@ -1065,16 +1239,26 @@ public:
|
||||
ClassTemplatePartialSpecializationDecl *PrevDecl,
|
||||
unsigned SequenceNumber);
|
||||
|
||||
static ClassTemplatePartialSpecializationDecl *
|
||||
Create(ASTContext &Context, EmptyShell Empty);
|
||||
|
||||
/// Get the list of template parameters
|
||||
TemplateParameterList *getTemplateParameters() const {
|
||||
return TemplateParams;
|
||||
}
|
||||
|
||||
void initTemplateParameters(TemplateParameterList *Params) {
|
||||
assert(TemplateParams == 0 && "TemplateParams already set");
|
||||
TemplateParams = Params;
|
||||
}
|
||||
|
||||
/// Get the template arguments as written.
|
||||
TemplateArgumentLoc *getTemplateArgsAsWritten() const {
|
||||
return ArgsAsWritten;
|
||||
}
|
||||
|
||||
void initTemplateArgsAsWritten(const TemplateArgumentListInfo &ArgInfos);
|
||||
|
||||
/// Get the number of template arguments as written.
|
||||
unsigned getNumTemplateArgsAsWritten() const {
|
||||
return NumArgsAsWritten;
|
||||
@ -1083,6 +1267,7 @@ public:
|
||||
/// \brief Get the sequence number for this class template partial
|
||||
/// specialization.
|
||||
unsigned getSequenceNumber() const { return SequenceNumber; }
|
||||
void setSequenceNumber(unsigned N) { SequenceNumber = N; }
|
||||
|
||||
/// \brief Retrieve the member class template partial specialization from
|
||||
/// which this particular class template partial specialization was
|
||||
@ -1199,26 +1384,19 @@ protected:
|
||||
llvm::PointerIntPair<ClassTemplateDecl *, 1, bool> InstantiatedFromMember;
|
||||
};
|
||||
|
||||
// FIXME: Combine PreviousDeclaration with CommonPtr, as in
|
||||
// FunctionTemplateDecl.
|
||||
|
||||
/// \brief Previous declaration of this class template.
|
||||
ClassTemplateDecl *PreviousDeclaration;
|
||||
/// \brief A pointer to the previous declaration (if this is a redeclaration)
|
||||
/// or to the data that is common to all declarations of this class template.
|
||||
llvm::PointerUnion<Common*, ClassTemplateDecl*> CommonOrPrev;
|
||||
|
||||
/// \brief Pointer to the data that is common to all of the
|
||||
/// declarations of this class template.
|
||||
///
|
||||
/// The first declaration of a class template (e.g., the declaration
|
||||
/// with no "previous declaration") owns this pointer.
|
||||
Common *CommonPtr;
|
||||
/// \brief Retrieves the "common" pointer shared by all
|
||||
/// (re-)declarations of the same class template. Calling this routine
|
||||
/// may implicitly allocate memory for the common pointer.
|
||||
Common *getCommonPtr();
|
||||
|
||||
ClassTemplateDecl(DeclContext *DC, SourceLocation L, DeclarationName Name,
|
||||
TemplateParameterList *Params, NamedDecl *Decl,
|
||||
ClassTemplateDecl *PrevDecl, Common *CommonPtr)
|
||||
TemplateParameterList *Params, NamedDecl *Decl)
|
||||
: TemplateDecl(ClassTemplate, DC, L, Name, Params, Decl),
|
||||
PreviousDeclaration(PrevDecl), CommonPtr(CommonPtr) { }
|
||||
|
||||
~ClassTemplateDecl();
|
||||
CommonOrPrev((Common*)0) { }
|
||||
|
||||
public:
|
||||
/// Get the underlying class declarations of the template.
|
||||
@ -1226,13 +1404,30 @@ public:
|
||||
return static_cast<CXXRecordDecl *>(TemplatedDecl);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the previous declaration of this template.
|
||||
ClassTemplateDecl *getPreviousDeclaration() const {
|
||||
return PreviousDeclaration;
|
||||
/// \brief Retrieve the previous declaration of this class template, or
|
||||
/// NULL if no such declaration exists.
|
||||
const ClassTemplateDecl *getPreviousDeclaration() const {
|
||||
return CommonOrPrev.dyn_cast<ClassTemplateDecl*>();
|
||||
}
|
||||
|
||||
/// \brief Retrieve the previous declaration of this function template, or
|
||||
/// NULL if no such declaration exists.
|
||||
ClassTemplateDecl *getPreviousDeclaration() {
|
||||
return CommonOrPrev.dyn_cast<ClassTemplateDecl*>();
|
||||
}
|
||||
|
||||
/// \brief Set the previous declaration of this class template.
|
||||
void setPreviousDeclaration(ClassTemplateDecl *Prev) {
|
||||
if (Prev)
|
||||
CommonOrPrev = Prev;
|
||||
}
|
||||
|
||||
virtual ClassTemplateDecl *getCanonicalDecl();
|
||||
|
||||
const ClassTemplateDecl *getCanonicalDecl() const {
|
||||
return const_cast<ClassTemplateDecl*>(this)->getCanonicalDecl();
|
||||
}
|
||||
|
||||
/// Create a class template node.
|
||||
static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
@ -1243,14 +1438,14 @@ public:
|
||||
|
||||
/// \brief Retrieve the set of specializations of this class template.
|
||||
llvm::FoldingSet<ClassTemplateSpecializationDecl> &getSpecializations() {
|
||||
return CommonPtr->Specializations;
|
||||
return getCommonPtr()->Specializations;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the set of partial specializations of this class
|
||||
/// template.
|
||||
llvm::FoldingSet<ClassTemplatePartialSpecializationDecl> &
|
||||
getPartialSpecializations() {
|
||||
return CommonPtr->PartialSpecializations;
|
||||
return getCommonPtr()->PartialSpecializations;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the partial specializations as an ordered list.
|
||||
@ -1281,7 +1476,7 @@ public:
|
||||
/// typedef array this_type; // "array" is equivalent to "array<T, N>"
|
||||
/// };
|
||||
/// \endcode
|
||||
QualType getInjectedClassNameSpecialization(ASTContext &Context);
|
||||
QualType getInjectedClassNameSpecialization();
|
||||
|
||||
/// \brief Retrieve the member class template that this class template was
|
||||
/// derived from.
|
||||
@ -1303,13 +1498,13 @@ public:
|
||||
/// X<T>::A<U>, a TemplateClassDecl (whose parent is X<T>, also a TCD).
|
||||
///
|
||||
/// \returns null if this is not an instantiation of a member class template.
|
||||
ClassTemplateDecl *getInstantiatedFromMemberTemplate() const {
|
||||
return CommonPtr->InstantiatedFromMember.getPointer();
|
||||
ClassTemplateDecl *getInstantiatedFromMemberTemplate() {
|
||||
return getCommonPtr()->InstantiatedFromMember.getPointer();
|
||||
}
|
||||
|
||||
void setInstantiatedFromMemberTemplate(ClassTemplateDecl *CTD) {
|
||||
assert(!CommonPtr->InstantiatedFromMember.getPointer());
|
||||
CommonPtr->InstantiatedFromMember.setPointer(CTD);
|
||||
assert(!getCommonPtr()->InstantiatedFromMember.getPointer());
|
||||
getCommonPtr()->InstantiatedFromMember.setPointer(CTD);
|
||||
}
|
||||
|
||||
/// \brief Determines whether this template was a specialization of a
|
||||
@ -1328,14 +1523,14 @@ public:
|
||||
/// struct X<int>::Inner { /* ... */ };
|
||||
/// \endcode
|
||||
bool isMemberSpecialization() {
|
||||
return CommonPtr->InstantiatedFromMember.getInt();
|
||||
return getCommonPtr()->InstantiatedFromMember.getInt();
|
||||
}
|
||||
|
||||
/// \brief Note that this member template is a specialization.
|
||||
void setMemberSpecialization() {
|
||||
assert(CommonPtr->InstantiatedFromMember.getPointer() &&
|
||||
assert(getCommonPtr()->InstantiatedFromMember.getPointer() &&
|
||||
"Only member templates can be member template specializations");
|
||||
CommonPtr->InstantiatedFromMember.setInt(true);
|
||||
getCommonPtr()->InstantiatedFromMember.setInt(true);
|
||||
}
|
||||
|
||||
// Implement isa/cast/dyncast support
|
||||
@ -1344,6 +1539,9 @@ public:
|
||||
static bool classofKind(Kind K) { return K == ClassTemplate; }
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
friend class PCHDeclReader;
|
||||
friend class PCHDeclWriter;
|
||||
};
|
||||
|
||||
/// Declaration of a friend template. For example:
|
||||
|
@ -30,20 +30,19 @@ class DeclVisitor {
|
||||
public:
|
||||
RetTy Visit(Decl *D) {
|
||||
switch (D->getKind()) {
|
||||
default: assert(false && "Decl that isn't part of DeclNodes.def!");
|
||||
#define DECL(Derived, Base) \
|
||||
case Decl::Derived: DISPATCH(Derived##Decl, Derived##Decl);
|
||||
#define ABSTRACT_DECL(Derived, Base)
|
||||
#include "clang/AST/DeclNodes.def"
|
||||
default: assert(false && "Decl that isn't part of DeclNodes.inc!");
|
||||
#define DECL(DERIVED, BASE) \
|
||||
case Decl::DERIVED: DISPATCH(DERIVED##Decl, DERIVED##Decl);
|
||||
#define ABSTRACT_DECL(DECL)
|
||||
#include "clang/AST/DeclNodes.inc"
|
||||
}
|
||||
}
|
||||
|
||||
// If the implementation chooses not to implement a certain visit
|
||||
// method, fall back to the parent.
|
||||
#define DECL(Derived, Base) \
|
||||
RetTy Visit##Derived##Decl(Derived##Decl *D) { DISPATCH(Base, Base); }
|
||||
#define ABSTRACT_DECL(Derived, Base) DECL(Derived, Base)
|
||||
#include "clang/AST/DeclNodes.def"
|
||||
#define DECL(DERIVED, BASE) \
|
||||
RetTy Visit##DERIVED##Decl(DERIVED##Decl *D) { DISPATCH(BASE, BASE); }
|
||||
#include "clang/AST/DeclNodes.inc"
|
||||
|
||||
RetTy VisitDecl(Decl *D) { return RetTy(); }
|
||||
};
|
||||
|
@ -162,9 +162,6 @@ public:
|
||||
};
|
||||
isLvalueResult isLvalue(ASTContext &Ctx) const;
|
||||
|
||||
// Same as above, but excluding checks for non-object and void types in C
|
||||
isLvalueResult isLvalueInternal(ASTContext &Ctx) const;
|
||||
|
||||
/// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
|
||||
/// does not have an incomplete type, does not have a const-qualified type,
|
||||
/// and if it is a structure or union, does not have any member (including,
|
||||
@ -194,6 +191,95 @@ public:
|
||||
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx,
|
||||
SourceLocation *Loc = 0) const;
|
||||
|
||||
/// \brief The return type of classify(). Represents the C++0x expression
|
||||
/// taxonomy.
|
||||
class Classification {
|
||||
public:
|
||||
/// \brief The various classification results. Most of these mean prvalue.
|
||||
enum Kinds {
|
||||
CL_LValue,
|
||||
CL_XValue,
|
||||
CL_Function, // Functions cannot be lvalues in C.
|
||||
CL_Void, // Void cannot be an lvalue in C.
|
||||
CL_DuplicateVectorComponents, // A vector shuffle with dupes.
|
||||
CL_MemberFunction, // An expression referring to a member function
|
||||
CL_SubObjCPropertySetting,
|
||||
CL_ClassTemporary, // A prvalue of class type
|
||||
CL_PRValue // A prvalue for any other reason, of any other type
|
||||
};
|
||||
/// \brief The results of modification testing.
|
||||
enum ModifiableType {
|
||||
CM_Untested, // testModifiable was false.
|
||||
CM_Modifiable,
|
||||
CM_RValue, // Not modifiable because it's an rvalue
|
||||
CM_Function, // Not modifiable because it's a function; C++ only
|
||||
CM_LValueCast, // Same as CM_RValue, but indicates GCC cast-as-lvalue ext
|
||||
CM_NotBlockQualified, // Not captured in the closure
|
||||
CM_NoSetterProperty,// Implicit assignment to ObjC property without setter
|
||||
CM_ConstQualified,
|
||||
CM_ArrayType,
|
||||
CM_IncompleteType
|
||||
};
|
||||
|
||||
private:
|
||||
friend class Expr;
|
||||
|
||||
unsigned short Kind;
|
||||
unsigned short Modifiable;
|
||||
|
||||
explicit Classification(Kinds k, ModifiableType m)
|
||||
: Kind(k), Modifiable(m)
|
||||
{}
|
||||
|
||||
public:
|
||||
Classification() {}
|
||||
|
||||
Kinds getKind() const { return static_cast<Kinds>(Kind); }
|
||||
ModifiableType getModifiable() const {
|
||||
assert(Modifiable != CM_Untested && "Did not test for modifiability.");
|
||||
return static_cast<ModifiableType>(Modifiable);
|
||||
}
|
||||
bool isLValue() const { return Kind == CL_LValue; }
|
||||
bool isXValue() const { return Kind == CL_XValue; }
|
||||
bool isGLValue() const { return Kind <= CL_XValue; }
|
||||
bool isPRValue() const { return Kind >= CL_Function; }
|
||||
bool isRValue() const { return Kind >= CL_XValue; }
|
||||
bool isModifiable() const { return getModifiable() == CM_Modifiable; }
|
||||
};
|
||||
/// \brief classify - Classify this expression according to the C++0x
|
||||
/// expression taxonomy.
|
||||
///
|
||||
/// C++0x defines ([basic.lval]) a new taxonomy of expressions to replace the
|
||||
/// old lvalue vs rvalue. This function determines the type of expression this
|
||||
/// is. There are three expression types:
|
||||
/// - lvalues are classical lvalues as in C++03.
|
||||
/// - prvalues are equivalent to rvalues in C++03.
|
||||
/// - xvalues are expressions yielding unnamed rvalue references, e.g. a
|
||||
/// function returning an rvalue reference.
|
||||
/// lvalues and xvalues are collectively referred to as glvalues, while
|
||||
/// prvalues and xvalues together form rvalues.
|
||||
/// If a
|
||||
Classification Classify(ASTContext &Ctx) const {
|
||||
return ClassifyImpl(Ctx, 0);
|
||||
}
|
||||
|
||||
/// \brief classifyModifiable - Classify this expression according to the
|
||||
/// C++0x expression taxonomy, and see if it is valid on the left side
|
||||
/// of an assignment.
|
||||
///
|
||||
/// This function extends classify in that it also tests whether the
|
||||
/// expression is modifiable (C99 6.3.2.1p1).
|
||||
/// \param Loc A source location that might be filled with a relevant location
|
||||
/// if the expression is not modifiable.
|
||||
Classification ClassifyModifiable(ASTContext &Ctx, SourceLocation &Loc) const{
|
||||
return ClassifyImpl(Ctx, &Loc);
|
||||
}
|
||||
|
||||
private:
|
||||
Classification ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const;
|
||||
|
||||
public:
|
||||
|
||||
/// \brief If this expression refers to a bit-field, retrieve the
|
||||
/// declaration of that bit-field.
|
||||
FieldDecl *getBitField();
|
||||
@ -414,6 +500,7 @@ struct ExplicitTemplateArgumentList {
|
||||
|
||||
void initializeFrom(const TemplateArgumentListInfo &List);
|
||||
void copyInto(TemplateArgumentListInfo &List) const;
|
||||
static std::size_t sizeFor(unsigned NumTemplateArgs);
|
||||
static std::size_t sizeFor(const TemplateArgumentListInfo &List);
|
||||
};
|
||||
|
||||
@ -474,27 +561,21 @@ class DeclRefExpr : public Expr {
|
||||
ValueDecl *D, SourceLocation NameLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs,
|
||||
QualType T);
|
||||
|
||||
/// \brief Construct an empty declaration reference expression.
|
||||
explicit DeclRefExpr(EmptyShell Empty)
|
||||
: Expr(DeclRefExprClass, Empty) { }
|
||||
|
||||
protected:
|
||||
/// \brief Computes the type- and value-dependence flags for this
|
||||
/// declaration reference expression.
|
||||
void computeDependence();
|
||||
|
||||
DeclRefExpr(StmtClass SC, ValueDecl *d, QualType t, SourceLocation l) :
|
||||
Expr(SC, t, false, false), DecoratedD(d, 0), Loc(l) {
|
||||
computeDependence();
|
||||
}
|
||||
|
||||
public:
|
||||
DeclRefExpr(ValueDecl *d, QualType t, SourceLocation l) :
|
||||
Expr(DeclRefExprClass, t, false, false), DecoratedD(d, 0), Loc(l) {
|
||||
computeDependence();
|
||||
}
|
||||
|
||||
/// \brief Construct an empty declaration reference expression.
|
||||
explicit DeclRefExpr(EmptyShell Empty)
|
||||
: Expr(DeclRefExprClass, Empty) { }
|
||||
|
||||
static DeclRefExpr *Create(ASTContext &Context,
|
||||
NestedNameSpecifier *Qualifier,
|
||||
SourceRange QualifierRange,
|
||||
@ -502,6 +583,10 @@ public:
|
||||
SourceLocation NameLoc,
|
||||
QualType T,
|
||||
const TemplateArgumentListInfo *TemplateArgs = 0);
|
||||
|
||||
/// \brief Construct an empty declaration reference expression.
|
||||
static DeclRefExpr *CreateEmpty(ASTContext &Context,
|
||||
bool HasQualifier, unsigned NumTemplateArgs);
|
||||
|
||||
ValueDecl *getDecl() { return DecoratedD.getPointer(); }
|
||||
const ValueDecl *getDecl() const { return DecoratedD.getPointer(); }
|
||||
@ -591,6 +676,9 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
friend class PCHStmtWriter;
|
||||
};
|
||||
|
||||
/// PredefinedExpr - [C99 6.4.2.2] - A predefined identifier such as __func__.
|
||||
@ -1560,11 +1648,6 @@ public:
|
||||
Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow),
|
||||
HasQualifierOrFoundDecl(false), HasExplicitTemplateArgumentList(false) {}
|
||||
|
||||
/// \brief Build an empty member reference expression.
|
||||
explicit MemberExpr(EmptyShell Empty)
|
||||
: Expr(MemberExprClass, Empty), HasQualifierOrFoundDecl(false),
|
||||
HasExplicitTemplateArgumentList(false) { }
|
||||
|
||||
static MemberExpr *Create(ASTContext &C, Expr *base, bool isarrow,
|
||||
NestedNameSpecifier *qual, SourceRange qualrange,
|
||||
ValueDecl *memberdecl, DeclAccessPair founddecl,
|
||||
@ -1937,6 +2020,7 @@ public:
|
||||
}
|
||||
|
||||
const CXXBaseSpecifierArray& getBasePath() const { return BasePath; }
|
||||
CXXBaseSpecifierArray& getBasePath() { return BasePath; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() >= firstCastExprConstant &&
|
||||
@ -2169,7 +2253,8 @@ public:
|
||||
|
||||
/// predicates to categorize the respective opcodes.
|
||||
bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
|
||||
bool isAdditiveOp() const { return Opc == Add || Opc == Sub; }
|
||||
static bool isAdditiveOp(Opcode Opc) { return Opc == Add || Opc == Sub; }
|
||||
bool isAdditiveOp() const { return isAdditiveOp(Opc); }
|
||||
static bool isShiftOp(Opcode Opc) { return Opc == Shl || Opc == Shr; }
|
||||
bool isShiftOp() const { return isShiftOp(Opc); }
|
||||
|
||||
@ -3153,7 +3238,7 @@ public:
|
||||
~ParenListExpr() {}
|
||||
|
||||
/// \brief Build an empty paren list.
|
||||
//explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
|
||||
explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
|
||||
|
||||
unsigned getNumExprs() const { return NumExprs; }
|
||||
|
||||
@ -3183,6 +3268,9 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
friend class PCHStmtWriter;
|
||||
};
|
||||
|
||||
|
||||
@ -3305,12 +3393,15 @@ class BlockDeclRefExpr : public Expr {
|
||||
SourceLocation Loc;
|
||||
bool IsByRef : 1;
|
||||
bool ConstQualAdded : 1;
|
||||
Stmt *CopyConstructorVal;
|
||||
public:
|
||||
// FIXME: Fix type/value dependence!
|
||||
BlockDeclRefExpr(ValueDecl *d, QualType t, SourceLocation l, bool ByRef,
|
||||
bool constAdded = false)
|
||||
: Expr(BlockDeclRefExprClass, t, false, false), D(d), Loc(l), IsByRef(ByRef),
|
||||
ConstQualAdded(constAdded) {}
|
||||
bool constAdded = false,
|
||||
Stmt *copyConstructorVal = 0)
|
||||
: Expr(BlockDeclRefExprClass, t, (!t.isNull() && t->isDependentType()),false),
|
||||
D(d), Loc(l), IsByRef(ByRef),
|
||||
ConstQualAdded(constAdded), CopyConstructorVal(copyConstructorVal) {}
|
||||
|
||||
// \brief Build an empty reference to a declared variable in a
|
||||
// block.
|
||||
@ -3331,6 +3422,12 @@ public:
|
||||
|
||||
bool isConstQualAdded() const { return ConstQualAdded; }
|
||||
void setConstQualAdded(bool C) { ConstQualAdded = C; }
|
||||
|
||||
const Expr *getCopyConstructorExpr() const
|
||||
{ return cast_or_null<Expr>(CopyConstructorVal); }
|
||||
Expr *getCopyConstructorExpr()
|
||||
{ return cast_or_null<Expr>(CopyConstructorVal); }
|
||||
void setCopyConstructorExpr(Expr *E) { CopyConstructorVal = E; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == BlockDeclRefExprClass;
|
||||
|
@ -465,7 +465,6 @@ class CXXDefaultArgExpr : public Expr {
|
||||
/// \brief The location where the default argument expression was used.
|
||||
SourceLocation Loc;
|
||||
|
||||
protected:
|
||||
CXXDefaultArgExpr(StmtClass SC, SourceLocation Loc, ParmVarDecl *param)
|
||||
: Expr(SC,
|
||||
param->hasUnparsedDefaultArg()
|
||||
@ -504,9 +503,6 @@ public:
|
||||
// Retrieve the parameter that the argument was created from.
|
||||
const ParmVarDecl *getParam() const { return Param.getPointer(); }
|
||||
ParmVarDecl *getParam() { return Param.getPointer(); }
|
||||
|
||||
/// isExprStored - Return true if this expression owns the expression.
|
||||
bool isExprStored() const { return Param.getInt(); }
|
||||
|
||||
// Retrieve the actual argument to the function call.
|
||||
const Expr *getExpr() const {
|
||||
@ -519,16 +515,10 @@ public:
|
||||
return *reinterpret_cast<Expr **> (this + 1);
|
||||
return getParam()->getDefaultArg();
|
||||
}
|
||||
|
||||
void setExpr(Expr *E) {
|
||||
Param.setInt(true);
|
||||
Param.setPointer((ParmVarDecl*)E);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the location where this default argument was actually
|
||||
/// used.
|
||||
SourceLocation getUsedLocation() const { return Loc; }
|
||||
void setUsedLocation(SourceLocation L) { Loc = L; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
// Default argument expressions have no representation in the
|
||||
@ -544,6 +534,9 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
friend class PCHStmtWriter;
|
||||
};
|
||||
|
||||
/// CXXTemporary - Represents a C++ temporary.
|
||||
@ -655,6 +648,9 @@ public:
|
||||
static CXXBindReferenceExpr *Create(ASTContext &C, Expr *SubExpr,
|
||||
bool ExtendsLifetime,
|
||||
bool RequiresTemporaryCopy);
|
||||
|
||||
explicit CXXBindReferenceExpr(EmptyShell Empty)
|
||||
: Expr(CXXBindReferenceExprClass, Empty) { }
|
||||
|
||||
const Expr *getSubExpr() const { return cast<Expr>(SubExpr); }
|
||||
Expr *getSubExpr() { return cast<Expr>(SubExpr); }
|
||||
@ -670,7 +666,7 @@ public:
|
||||
|
||||
// extendsLifetime - Whether binding this reference extends the lifetime of
|
||||
// the expression being bound. FIXME: Add C++ reference.
|
||||
bool extendsLifetime() { return ExtendsLifetime; }
|
||||
bool extendsLifetime() const { return ExtendsLifetime; }
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const Stmt *T) {
|
||||
@ -681,6 +677,8 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
};
|
||||
|
||||
/// CXXConstructExpr - Represents a call to a C++ constructor.
|
||||
@ -711,13 +709,20 @@ protected:
|
||||
ConstructionKind ConstructKind = CK_Complete);
|
||||
~CXXConstructExpr() { }
|
||||
|
||||
/// \brief Construct an empty C++ construction expression.
|
||||
CXXConstructExpr(StmtClass SC, EmptyShell Empty)
|
||||
: Expr(SC, Empty), Constructor(0), Elidable(0), ZeroInitialization(0),
|
||||
ConstructKind(0), Args(0), NumArgs(0) { }
|
||||
|
||||
virtual void DoDestroy(ASTContext &C);
|
||||
|
||||
public:
|
||||
/// \brief Construct an empty C++ construction expression that will store
|
||||
/// \p numargs arguments.
|
||||
CXXConstructExpr(EmptyShell Empty, ASTContext &C, unsigned numargs);
|
||||
|
||||
/// \brief Construct an empty C++ construction expression.
|
||||
explicit CXXConstructExpr(EmptyShell Empty)
|
||||
: Expr(CXXConstructExprClass, Empty), Constructor(0),
|
||||
Elidable(0), ZeroInitialization(0),
|
||||
ConstructKind(0), Args(0), NumArgs(0) { }
|
||||
|
||||
static CXXConstructExpr *Create(ASTContext &C, QualType T,
|
||||
SourceLocation Loc,
|
||||
CXXConstructorDecl *D, bool Elidable,
|
||||
@ -790,6 +795,8 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
};
|
||||
|
||||
/// CXXFunctionalCastExpr - Represents an explicit C++ type conversion
|
||||
@ -829,12 +836,8 @@ public:
|
||||
///
|
||||
/// This expression type represents a C++ "functional" cast
|
||||
/// (C++[expr.type.conv]) with N != 1 arguments that invokes a
|
||||
/// constructor to build a temporary object. If N == 0 but no
|
||||
/// constructor will be called (because the functional cast is
|
||||
/// performing a value-initialized an object whose class type has no
|
||||
/// user-declared constructors), CXXZeroInitValueExpr will represent
|
||||
/// the functional cast. Finally, with N == 1 arguments the functional
|
||||
/// cast expression will be represented by CXXFunctionalCastExpr.
|
||||
/// constructor to build a temporary object. With N == 1 arguments the
|
||||
/// functional cast expression will be represented by CXXFunctionalCastExpr.
|
||||
/// Example:
|
||||
/// @code
|
||||
/// struct X { X(int, float); }
|
||||
@ -853,6 +856,8 @@ public:
|
||||
Expr **Args,unsigned NumArgs,
|
||||
SourceLocation rParenLoc,
|
||||
bool ZeroInitialization = false);
|
||||
explicit CXXTemporaryObjectExpr(EmptyShell Empty)
|
||||
: CXXConstructExpr(CXXTemporaryObjectExprClass, Empty) { }
|
||||
|
||||
~CXXTemporaryObjectExpr() { }
|
||||
|
||||
@ -866,24 +871,25 @@ public:
|
||||
return T->getStmtClass() == CXXTemporaryObjectExprClass;
|
||||
}
|
||||
static bool classof(const CXXTemporaryObjectExpr *) { return true; }
|
||||
|
||||
friend class PCHStmtReader;
|
||||
};
|
||||
|
||||
/// CXXZeroInitValueExpr - [C++ 5.2.3p2]
|
||||
/// CXXScalarValueInitExpr - [C++ 5.2.3p2]
|
||||
/// Expression "T()" which creates a value-initialized rvalue of type
|
||||
/// T, which is either a non-class type or a class type without any
|
||||
/// user-defined constructors.
|
||||
/// T, which is a non-class type.
|
||||
///
|
||||
class CXXZeroInitValueExpr : public Expr {
|
||||
class CXXScalarValueInitExpr : public Expr {
|
||||
SourceLocation TyBeginLoc;
|
||||
SourceLocation RParenLoc;
|
||||
|
||||
public:
|
||||
CXXZeroInitValueExpr(QualType ty, SourceLocation tyBeginLoc,
|
||||
CXXScalarValueInitExpr(QualType ty, SourceLocation tyBeginLoc,
|
||||
SourceLocation rParenLoc ) :
|
||||
Expr(CXXZeroInitValueExprClass, ty, false, false),
|
||||
Expr(CXXScalarValueInitExprClass, ty, false, false),
|
||||
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {}
|
||||
explicit CXXZeroInitValueExpr(EmptyShell Shell)
|
||||
: Expr(CXXZeroInitValueExprClass, Shell) { }
|
||||
explicit CXXScalarValueInitExpr(EmptyShell Shell)
|
||||
: Expr(CXXScalarValueInitExprClass, Shell) { }
|
||||
|
||||
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
@ -902,9 +908,9 @@ public:
|
||||
}
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXZeroInitValueExprClass;
|
||||
return T->getStmtClass() == CXXScalarValueInitExprClass;
|
||||
}
|
||||
static bool classof(const CXXZeroInitValueExpr *) { return true; }
|
||||
static bool classof(const CXXScalarValueInitExpr *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
@ -916,15 +922,13 @@ public:
|
||||
class CXXNewExpr : public Expr {
|
||||
// Was the usage ::new, i.e. is the global new to be used?
|
||||
bool GlobalNew : 1;
|
||||
// Was the form (type-id) used? Otherwise, it was new-type-id.
|
||||
bool ParenTypeId : 1;
|
||||
// Is there an initializer? If not, built-ins are uninitialized, else they're
|
||||
// value-initialized.
|
||||
bool Initializer : 1;
|
||||
// Do we allocate an array? If so, the first SubExpr is the size expression.
|
||||
bool Array : 1;
|
||||
// The number of placement new arguments.
|
||||
unsigned NumPlacementArgs : 14;
|
||||
unsigned NumPlacementArgs : 15;
|
||||
// The number of constructor arguments. This may be 1 even for non-class
|
||||
// types; use the pseudo copy constructor.
|
||||
unsigned NumConstructorArgs : 14;
|
||||
@ -941,12 +945,18 @@ class CXXNewExpr : public Expr {
|
||||
// Must be null for all other types.
|
||||
CXXConstructorDecl *Constructor;
|
||||
|
||||
/// \brief If the allocated type was expressed as a parenthesized type-id,
|
||||
/// the source range covering the parenthesized type-id.
|
||||
SourceRange TypeIdParens;
|
||||
|
||||
SourceLocation StartLoc;
|
||||
SourceLocation EndLoc;
|
||||
|
||||
friend class PCHStmtReader;
|
||||
public:
|
||||
CXXNewExpr(ASTContext &C, bool globalNew, FunctionDecl *operatorNew,
|
||||
Expr **placementArgs, unsigned numPlaceArgs, bool ParenTypeId,
|
||||
Expr **placementArgs, unsigned numPlaceArgs,
|
||||
SourceRange TypeIdParens,
|
||||
Expr *arraySize, CXXConstructorDecl *constructor, bool initializer,
|
||||
Expr **constructorArgs, unsigned numConsArgs,
|
||||
FunctionDecl *operatorDelete, QualType ty,
|
||||
@ -989,10 +999,11 @@ public:
|
||||
return cast<Expr>(SubExprs[Array + i]);
|
||||
}
|
||||
|
||||
bool isParenTypeId() const { return TypeIdParens.isValid(); }
|
||||
SourceRange getTypeIdParens() const { return TypeIdParens; }
|
||||
|
||||
bool isGlobalNew() const { return GlobalNew; }
|
||||
void setGlobalNew(bool V) { GlobalNew = V; }
|
||||
bool isParenTypeId() const { return ParenTypeId; }
|
||||
void setParenTypeId(bool V) { ParenTypeId = V; }
|
||||
bool hasInitializer() const { return Initializer; }
|
||||
void setHasInitializer(bool V) { Initializer = V; }
|
||||
|
||||
@ -1082,18 +1093,26 @@ public:
|
||||
: Expr(CXXDeleteExprClass, ty, false, false), GlobalDelete(globalDelete),
|
||||
ArrayForm(arrayForm), OperatorDelete(operatorDelete), Argument(arg),
|
||||
Loc(loc) { }
|
||||
explicit CXXDeleteExpr(EmptyShell Shell)
|
||||
: Expr(CXXDeleteExprClass, Shell), OperatorDelete(0), Argument(0) { }
|
||||
|
||||
bool isGlobalDelete() const { return GlobalDelete; }
|
||||
bool isArrayForm() const { return ArrayForm; }
|
||||
|
||||
void setGlobalDelete(bool V) { GlobalDelete = V; }
|
||||
void setArrayForm(bool V) { ArrayForm = V; }
|
||||
|
||||
FunctionDecl *getOperatorDelete() const { return OperatorDelete; }
|
||||
void setOperatorDelete(FunctionDecl *D) { OperatorDelete = D; }
|
||||
|
||||
Expr *getArgument() { return cast<Expr>(Argument); }
|
||||
const Expr *getArgument() const { return cast<Expr>(Argument); }
|
||||
void setArgument(Expr *E) { Argument = E; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(Loc, Argument->getLocEnd());
|
||||
}
|
||||
void setStartLoc(SourceLocation L) { Loc = L; }
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == CXXDeleteExprClass;
|
||||
@ -1215,6 +1234,10 @@ public:
|
||||
ScopeType(ScopeType), ColonColonLoc(ColonColonLoc), TildeLoc(TildeLoc),
|
||||
DestroyedType(DestroyedType) { }
|
||||
|
||||
explicit CXXPseudoDestructorExpr(EmptyShell Shell)
|
||||
: Expr(CXXPseudoDestructorExprClass, Shell),
|
||||
Base(0), IsArrow(false), Qualifier(0), ScopeType(0) { }
|
||||
|
||||
void setBase(Expr *E) { Base = E; }
|
||||
Expr *getBase() const { return cast<Expr>(Base); }
|
||||
|
||||
@ -1227,11 +1250,13 @@ public:
|
||||
/// the nested-name-specifier that precedes the member name. Otherwise,
|
||||
/// returns an empty source range.
|
||||
SourceRange getQualifierRange() const { return QualifierRange; }
|
||||
void setQualifierRange(SourceRange R) { QualifierRange = R; }
|
||||
|
||||
/// \brief If the member name was qualified, retrieves the
|
||||
/// nested-name-specifier that precedes the member name. Otherwise, returns
|
||||
/// NULL.
|
||||
NestedNameSpecifier *getQualifier() const { return Qualifier; }
|
||||
void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
|
||||
|
||||
/// \brief Determine whether this pseudo-destructor expression was written
|
||||
/// using an '->' (otherwise, it used a '.').
|
||||
@ -1240,6 +1265,7 @@ public:
|
||||
|
||||
/// \brief Retrieve the location of the '.' or '->' operator.
|
||||
SourceLocation getOperatorLoc() const { return OperatorLoc; }
|
||||
void setOperatorLoc(SourceLocation L) { OperatorLoc = L; }
|
||||
|
||||
/// \brief Retrieve the scope type in a qualified pseudo-destructor
|
||||
/// expression.
|
||||
@ -1251,13 +1277,16 @@ public:
|
||||
/// nested-name-specifier. It is stored as the "scope type" of the pseudo-
|
||||
/// destructor expression.
|
||||
TypeSourceInfo *getScopeTypeInfo() const { return ScopeType; }
|
||||
void setScopeTypeInfo(TypeSourceInfo *Info) { ScopeType = Info; }
|
||||
|
||||
/// \brief Retrieve the location of the '::' in a qualified pseudo-destructor
|
||||
/// expression.
|
||||
SourceLocation getColonColonLoc() const { return ColonColonLoc; }
|
||||
void setColonColonLoc(SourceLocation L) { ColonColonLoc = L; }
|
||||
|
||||
/// \brief Retrieve the location of the '~'.
|
||||
SourceLocation getTildeLoc() const { return TildeLoc; }
|
||||
void setTildeLoc(SourceLocation L) { TildeLoc = L; }
|
||||
|
||||
/// \brief Retrieve the source location information for the type
|
||||
/// being destroyed.
|
||||
@ -1285,6 +1314,17 @@ public:
|
||||
return DestroyedType.getLocation();
|
||||
}
|
||||
|
||||
/// \brief Set the name of destroyed type for a dependent pseudo-destructor
|
||||
/// expression.
|
||||
void setDestroyedType(IdentifierInfo *II, SourceLocation Loc) {
|
||||
DestroyedType = PseudoDestructorTypeStorage(II, Loc);
|
||||
}
|
||||
|
||||
/// \brief Set the destroyed type.
|
||||
void setDestroyedType(TypeSourceInfo *Info) {
|
||||
DestroyedType = PseudoDestructorTypeStorage(Info);
|
||||
}
|
||||
|
||||
virtual SourceRange getSourceRange() const;
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
@ -1321,6 +1361,9 @@ public:
|
||||
: Expr(UnaryTypeTraitExprClass, ty, false, queried->isDependentType()),
|
||||
UTT(utt), Loc(loc), RParen(rparen), QueriedType(queried) { }
|
||||
|
||||
explicit UnaryTypeTraitExpr(EmptyShell Empty)
|
||||
: Expr(UnaryTypeTraitExprClass, Empty), UTT((UnaryTypeTrait)0) { }
|
||||
|
||||
virtual SourceRange getSourceRange() const { return SourceRange(Loc, RParen);}
|
||||
|
||||
UnaryTypeTrait getTrait() const { return UTT; }
|
||||
@ -1337,6 +1380,8 @@ public:
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class PCHStmtReader;
|
||||
};
|
||||
|
||||
/// \brief A reference to an overloaded function set, either an
|
||||
@ -1361,16 +1406,20 @@ class OverloadExpr : public Expr {
|
||||
/// The location of the name.
|
||||
SourceLocation NameLoc;
|
||||
|
||||
protected:
|
||||
/// True if the name was a template-id.
|
||||
bool HasExplicitTemplateArgs;
|
||||
|
||||
protected:
|
||||
OverloadExpr(StmtClass K, ASTContext &C, QualType T, bool Dependent,
|
||||
NestedNameSpecifier *Qualifier, SourceRange QRange,
|
||||
DeclarationName Name, SourceLocation NameLoc,
|
||||
bool HasTemplateArgs,
|
||||
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
|
||||
|
||||
OverloadExpr(StmtClass K, EmptyShell Empty)
|
||||
: Expr(K, Empty), Results(0), NumResults(0),
|
||||
Qualifier(0), HasExplicitTemplateArgs(false) { }
|
||||
|
||||
public:
|
||||
/// Computes whether an unresolved lookup on the given declarations
|
||||
/// and optional template arguments is type- and value-dependent.
|
||||
@ -1401,6 +1450,9 @@ public:
|
||||
decls_iterator decls_end() const {
|
||||
return UnresolvedSetIterator(Results + NumResults);
|
||||
}
|
||||
|
||||
void initializeResults(ASTContext &C,
|
||||
UnresolvedSetIterator Begin,UnresolvedSetIterator End);
|
||||
|
||||
/// Gets the number of declarations in the unresolved set.
|
||||
unsigned getNumDecls() const { return NumResults; }
|
||||
@ -1415,9 +1467,11 @@ public:
|
||||
|
||||
/// Fetches the nested-name qualifier, if one was given.
|
||||
NestedNameSpecifier *getQualifier() const { return Qualifier; }
|
||||
void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
|
||||
|
||||
/// Fetches the range of the nested-name qualifier.
|
||||
SourceRange getQualifierRange() const { return QualifierRange; }
|
||||
void setQualifierRange(SourceRange R) { QualifierRange = R; }
|
||||
|
||||
/// \brief Determines whether this expression had an explicit
|
||||
/// template argument list, e.g. f<int>.
|
||||
@ -1480,6 +1534,11 @@ class UnresolvedLookupExpr : public OverloadExpr {
|
||||
RequiresADL(RequiresADL), Overloaded(Overloaded), NamingClass(NamingClass)
|
||||
{}
|
||||
|
||||
UnresolvedLookupExpr(EmptyShell Empty)
|
||||
: OverloadExpr(UnresolvedLookupExprClass, Empty),
|
||||
RequiresADL(false), Overloaded(false), NamingClass(0)
|
||||
{}
|
||||
|
||||
public:
|
||||
static UnresolvedLookupExpr *Create(ASTContext &C,
|
||||
bool Dependent,
|
||||
@ -1511,17 +1570,23 @@ public:
|
||||
UnresolvedSetIterator Begin,
|
||||
UnresolvedSetIterator End);
|
||||
|
||||
static UnresolvedLookupExpr *CreateEmpty(ASTContext &C,
|
||||
unsigned NumTemplateArgs);
|
||||
|
||||
/// True if this declaration should be extended by
|
||||
/// argument-dependent lookup.
|
||||
bool requiresADL() const { return RequiresADL; }
|
||||
void setRequiresADL(bool V) { RequiresADL = V; }
|
||||
|
||||
/// True if this lookup is overloaded.
|
||||
bool isOverloaded() const { return Overloaded; }
|
||||
void setOverloaded(bool V) { Overloaded = V; }
|
||||
|
||||
/// Gets the 'naming class' (in the sense of C++0x
|
||||
/// [class.access.base]p5) of the lookup. This is the scope
|
||||
/// that was looked in to find these results.
|
||||
CXXRecordDecl *getNamingClass() const { return NamingClass; }
|
||||
void setNamingClass(CXXRecordDecl *D) { NamingClass = D; }
|
||||
|
||||
// Note that, inconsistently with the explicit-template-argument AST
|
||||
// nodes, users are *forbidden* from calling these methods on objects
|
||||
@ -1628,18 +1693,25 @@ public:
|
||||
SourceLocation NameLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs = 0);
|
||||
|
||||
static DependentScopeDeclRefExpr *CreateEmpty(ASTContext &C,
|
||||
unsigned NumTemplateArgs);
|
||||
|
||||
/// \brief Retrieve the name that this expression refers to.
|
||||
DeclarationName getDeclName() const { return Name; }
|
||||
void setDeclName(DeclarationName N) { Name = N; }
|
||||
|
||||
/// \brief Retrieve the location of the name within the expression.
|
||||
SourceLocation getLocation() const { return Loc; }
|
||||
void setLocation(SourceLocation L) { Loc = L; }
|
||||
|
||||
/// \brief Retrieve the source range of the nested-name-specifier.
|
||||
SourceRange getQualifierRange() const { return QualifierRange; }
|
||||
void setQualifierRange(SourceRange R) { QualifierRange = R; }
|
||||
|
||||
/// \brief Retrieve the nested-name-specifier that qualifies this
|
||||
/// declaration.
|
||||
NestedNameSpecifier *getQualifier() const { return Qualifier; }
|
||||
void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
|
||||
|
||||
/// Determines whether this lookup had explicit template arguments.
|
||||
bool hasExplicitTemplateArgs() const { return HasExplicitTemplateArgs; }
|
||||
@ -1648,6 +1720,11 @@ public:
|
||||
// nodes, users are *forbidden* from calling these methods on objects
|
||||
// without explicit template arguments.
|
||||
|
||||
ExplicitTemplateArgumentList &getExplicitTemplateArgs() {
|
||||
assert(hasExplicitTemplateArgs());
|
||||
return *reinterpret_cast<ExplicitTemplateArgumentList*>(this + 1);
|
||||
}
|
||||
|
||||
/// Gets a reference to the explicit template argument list.
|
||||
const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const {
|
||||
assert(hasExplicitTemplateArgs());
|
||||
@ -1792,6 +1869,9 @@ class CXXUnresolvedConstructExpr : public Expr {
|
||||
unsigned NumArgs,
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs)
|
||||
: Expr(CXXUnresolvedConstructExprClass, Empty), NumArgs(NumArgs) { }
|
||||
|
||||
public:
|
||||
static CXXUnresolvedConstructExpr *Create(ASTContext &C,
|
||||
SourceLocation TyBegin,
|
||||
@ -1801,6 +1881,9 @@ public:
|
||||
unsigned NumArgs,
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
static CXXUnresolvedConstructExpr *CreateEmpty(ASTContext &C,
|
||||
unsigned NumArgs);
|
||||
|
||||
/// \brief Retrieve the source location where the type begins.
|
||||
SourceLocation getTypeBeginLoc() const { return TyBeginLoc; }
|
||||
void setTypeBeginLoc(SourceLocation L) { TyBeginLoc = L; }
|
||||
@ -1845,6 +1928,11 @@ public:
|
||||
return *(arg_begin() + I);
|
||||
}
|
||||
|
||||
void setArg(unsigned I, Expr *E) {
|
||||
assert(I < NumArgs && "Argument index out-of-range");
|
||||
*(arg_begin() + I) = E;
|
||||
}
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(TyBeginLoc, RParenLoc);
|
||||
}
|
||||
@ -1908,20 +1996,6 @@ class CXXDependentScopeMemberExpr : public Expr {
|
||||
/// \brief The location of the member name.
|
||||
SourceLocation MemberLoc;
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
|
||||
assert(HasExplicitTemplateArgs);
|
||||
return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
|
||||
return const_cast<CXXDependentScopeMemberExpr *>(this)
|
||||
->getExplicitTemplateArgumentList();
|
||||
}
|
||||
|
||||
CXXDependentScopeMemberExpr(ASTContext &C,
|
||||
Expr *Base, QualType BaseType, bool IsArrow,
|
||||
SourceLocation OperatorLoc,
|
||||
@ -1960,6 +2034,9 @@ public:
|
||||
SourceLocation MemberLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs);
|
||||
|
||||
static CXXDependentScopeMemberExpr *
|
||||
CreateEmpty(ASTContext &C, unsigned NumTemplateArgs);
|
||||
|
||||
/// \brief True if this is an implicit access, i.e. one in which the
|
||||
/// member being accessed was not written in the source. The source
|
||||
/// location of the operator is invalid in this case.
|
||||
@ -1974,6 +2051,7 @@ public:
|
||||
void setBase(Expr *E) { Base = E; }
|
||||
|
||||
QualType getBaseType() const { return BaseType; }
|
||||
void setBaseType(QualType T) { BaseType = T; }
|
||||
|
||||
/// \brief Determine whether this member expression used the '->'
|
||||
/// operator; otherwise, it used the '.' operator.
|
||||
@ -1987,10 +2065,12 @@ public:
|
||||
/// \brief Retrieve the nested-name-specifier that qualifies the member
|
||||
/// name.
|
||||
NestedNameSpecifier *getQualifier() const { return Qualifier; }
|
||||
void setQualifier(NestedNameSpecifier *NNS) { Qualifier = NNS; }
|
||||
|
||||
/// \brief Retrieve the source range covering the nested-name-specifier
|
||||
/// that qualifies the member name.
|
||||
SourceRange getQualifierRange() const { return QualifierRange; }
|
||||
void setQualifierRange(SourceRange R) { QualifierRange = R; }
|
||||
|
||||
/// \brief Retrieve the first part of the nested-name-specifier that was
|
||||
/// found in the scope of the member access expression when the member access
|
||||
@ -2006,6 +2086,9 @@ public:
|
||||
NamedDecl *getFirstQualifierFoundInScope() const {
|
||||
return FirstQualifierFoundInScope;
|
||||
}
|
||||
void setFirstQualifierFoundInScope(NamedDecl *D) {
|
||||
FirstQualifierFoundInScope = D;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the name of the member that this expression
|
||||
/// refers to.
|
||||
@ -2023,6 +2106,20 @@ public:
|
||||
return HasExplicitTemplateArgs;
|
||||
}
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() {
|
||||
assert(HasExplicitTemplateArgs);
|
||||
return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the explicit template argument list that followed the
|
||||
/// member template name, if any.
|
||||
const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const {
|
||||
return const_cast<CXXDependentScopeMemberExpr *>(this)
|
||||
->getExplicitTemplateArgumentList();
|
||||
}
|
||||
|
||||
/// \brief Copies the template arguments (if present) into the given
|
||||
/// structure.
|
||||
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const {
|
||||
@ -2030,6 +2127,12 @@ public:
|
||||
getExplicitTemplateArgumentList()->copyInto(List);
|
||||
}
|
||||
|
||||
/// \brief Initializes the template arguments using the given structure.
|
||||
void initializeTemplateArgumentsFrom(const TemplateArgumentListInfo &List) {
|
||||
assert(HasExplicitTemplateArgs);
|
||||
getExplicitTemplateArgumentList()->initializeFrom(List);
|
||||
}
|
||||
|
||||
/// \brief Retrieve the location of the left angle bracket following the
|
||||
/// member name ('<'), if any.
|
||||
SourceLocation getLAngleLoc() const {
|
||||
@ -2127,6 +2230,10 @@ class UnresolvedMemberExpr : public OverloadExpr {
|
||||
SourceLocation MemberLoc,
|
||||
const TemplateArgumentListInfo *TemplateArgs,
|
||||
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
|
||||
|
||||
UnresolvedMemberExpr(EmptyShell Empty)
|
||||
: OverloadExpr(UnresolvedMemberExprClass, Empty), IsArrow(false),
|
||||
HasUnresolvedUsing(false), Base(0) { }
|
||||
|
||||
public:
|
||||
static UnresolvedMemberExpr *
|
||||
@ -2140,6 +2247,9 @@ public:
|
||||
const TemplateArgumentListInfo *TemplateArgs,
|
||||
UnresolvedSetIterator Begin, UnresolvedSetIterator End);
|
||||
|
||||
static UnresolvedMemberExpr *
|
||||
CreateEmpty(ASTContext &C, unsigned NumTemplateArgs);
|
||||
|
||||
/// \brief True if this is an implicit access, i.e. one in which the
|
||||
/// member being accessed was not written in the source. The source
|
||||
/// location of the operator is invalid in this case.
|
||||
@ -2158,6 +2268,12 @@ public:
|
||||
void setBase(Expr *E) { Base = E; }
|
||||
|
||||
QualType getBaseType() const { return BaseType; }
|
||||
void setBaseType(QualType T) { BaseType = T; }
|
||||
|
||||
/// \brief Determine whether the lookup results contain an unresolved using
|
||||
/// declaration.
|
||||
bool hasUnresolvedUsing() const { return HasUnresolvedUsing; }
|
||||
void setHasUnresolvedUsing(bool V) { HasUnresolvedUsing = V; }
|
||||
|
||||
/// \brief Determine whether this member expression used the '->'
|
||||
/// operator; otherwise, it used the '.' operator.
|
||||
|
@ -58,67 +58,85 @@ public:
|
||||
|
||||
virtual ~ExternalASTSource();
|
||||
|
||||
/// \brief Resolve a type ID into a type, potentially building a new
|
||||
/// type.
|
||||
virtual QualType GetType(uint32_t ID) = 0;
|
||||
|
||||
/// \brief Resolve a declaration ID into a declaration, potentially
|
||||
/// building a new declaration.
|
||||
virtual Decl *GetDecl(uint32_t ID) = 0;
|
||||
///
|
||||
/// This method only needs to be implemented if the AST source ever
|
||||
/// passes back decl sets as VisibleDeclaration objects.
|
||||
virtual Decl *GetExternalDecl(uint32_t ID) = 0;
|
||||
|
||||
/// \brief Resolve a selector ID into a selector.
|
||||
virtual Selector GetSelector(uint32_t ID) = 0;
|
||||
///
|
||||
/// This operation only needs to be implemented if the AST source
|
||||
/// returns non-zero for GetNumKnownSelectors().
|
||||
virtual Selector GetExternalSelector(uint32_t ID) = 0;
|
||||
|
||||
/// \brief Returns the number of selectors known to the external AST
|
||||
/// source.
|
||||
virtual uint32_t GetNumKnownSelectors() = 0;
|
||||
virtual uint32_t GetNumExternalSelectors() = 0;
|
||||
|
||||
/// \brief Resolve the offset of a statement in the decl stream into a
|
||||
/// statement.
|
||||
/// \brief Resolve the offset of a statement in the decl stream into
|
||||
/// a statement.
|
||||
///
|
||||
/// This operation will read a new statement from the external
|
||||
/// source each time it is called, and is meant to be used via a
|
||||
/// LazyOffsetPtr.
|
||||
virtual Stmt *GetDeclStmt(uint64_t Offset) = 0;
|
||||
/// This operation is meant to be used via a LazyOffsetPtr. It only
|
||||
/// needs to be implemented if the AST source uses methods like
|
||||
/// FunctionDecl::setLazyBody when building decls.
|
||||
virtual Stmt *GetExternalDeclStmt(uint64_t Offset) = 0;
|
||||
|
||||
/// \brief Read all of the declarations lexically stored in a
|
||||
/// declaration context.
|
||||
/// \brief Finds all declarations with the given name in the
|
||||
/// given context.
|
||||
///
|
||||
/// \param DC The declaration context whose declarations will be
|
||||
/// read.
|
||||
///
|
||||
/// \param Decls Vector that will contain the declarations loaded
|
||||
/// from the external source. The caller is responsible for merging
|
||||
/// these declarations with any declarations already stored in the
|
||||
/// declaration context.
|
||||
///
|
||||
/// \returns true if there was an error while reading the
|
||||
/// declarations for this declaration context.
|
||||
virtual bool ReadDeclsLexicallyInContext(DeclContext *DC,
|
||||
llvm::SmallVectorImpl<uint32_t> &Decls) = 0;
|
||||
/// Generally the final step of this method is either to call
|
||||
/// SetExternalVisibleDeclsForName or to recursively call lookup on
|
||||
/// the DeclContext after calling SetExternalVisibleDecls.
|
||||
virtual DeclContext::lookup_result
|
||||
FindExternalVisibleDeclsByName(const DeclContext *DC,
|
||||
DeclarationName Name) = 0;
|
||||
|
||||
/// \brief Read all of the declarations visible from a declaration
|
||||
/// context.
|
||||
/// \brief Finds all declarations lexically contained within the given
|
||||
/// DeclContext.
|
||||
///
|
||||
/// \param DC The declaration context whose visible declarations
|
||||
/// will be read.
|
||||
///
|
||||
/// \param Decls A vector of visible declaration structures,
|
||||
/// providing the mapping from each name visible in the declaration
|
||||
/// context to the declaration IDs of declarations with that name.
|
||||
///
|
||||
/// \returns true if there was an error while reading the
|
||||
/// declarations for this declaration context.
|
||||
virtual bool ReadDeclsVisibleInContext(DeclContext *DC,
|
||||
llvm::SmallVectorImpl<VisibleDeclaration> & Decls) = 0;
|
||||
/// \return true if an error occurred
|
||||
virtual bool FindExternalLexicalDecls(const DeclContext *DC,
|
||||
llvm::SmallVectorImpl<Decl*> &Result) = 0;
|
||||
|
||||
/// \brief Function that will be invoked when we begin parsing a new
|
||||
/// translation unit involving this external AST source.
|
||||
///
|
||||
/// The default implementation of this method is a no-op.
|
||||
virtual void StartTranslationUnit(ASTConsumer *Consumer) { }
|
||||
|
||||
/// \brief Print any statistics that have been gathered regarding
|
||||
/// the external AST source.
|
||||
///
|
||||
/// The default implementation of this method is a no-op.
|
||||
virtual void PrintStats();
|
||||
|
||||
protected:
|
||||
/// \brief Initialize the context's lookup map with the given decls.
|
||||
/// It is assumed that none of the declarations are redeclarations of
|
||||
/// each other.
|
||||
static void SetExternalVisibleDecls(const DeclContext *DC,
|
||||
const llvm::SmallVectorImpl<VisibleDeclaration> &Decls);
|
||||
|
||||
/// \brief Initialize the context's lookup map with the given decls.
|
||||
/// It is assumed that none of the declarations are redeclarations of
|
||||
/// each other.
|
||||
static void SetExternalVisibleDecls(const DeclContext *DC,
|
||||
const llvm::SmallVectorImpl<NamedDecl*> &Decls);
|
||||
|
||||
static DeclContext::lookup_result
|
||||
SetExternalVisibleDeclsForName(const DeclContext *DC,
|
||||
const VisibleDeclaration &VD);
|
||||
|
||||
static DeclContext::lookup_result
|
||||
SetExternalVisibleDeclsForName(const DeclContext *DC,
|
||||
DeclarationName Name,
|
||||
llvm::SmallVectorImpl<NamedDecl*> &Decls);
|
||||
|
||||
static DeclContext::lookup_result
|
||||
SetNoExternalVisibleDeclsForName(const DeclContext *DC,
|
||||
DeclarationName Name);
|
||||
};
|
||||
|
||||
/// \brief A lazy pointer to an AST node (of base type T) that resides
|
||||
@ -185,7 +203,8 @@ public:
|
||||
};
|
||||
|
||||
/// \brief A lazy pointer to a statement.
|
||||
typedef LazyOffsetPtr<Stmt, &ExternalASTSource::GetDeclStmt> LazyDeclStmtPtr;
|
||||
typedef LazyOffsetPtr<Stmt, &ExternalASTSource::GetExternalDeclStmt>
|
||||
LazyDeclStmtPtr;
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
|
@ -1,13 +1,23 @@
|
||||
LEVEL = ../../../../..
|
||||
BUILT_SOURCES = StmtNodes.inc
|
||||
CLANG_LEVEL := ../../..
|
||||
TD_SRC_DIR = $(PROJ_SRC_DIR)/../Basic
|
||||
BUILT_SOURCES = Attrs.inc StmtNodes.inc DeclNodes.inc
|
||||
|
||||
TABLEGEN_INC_FILES_COMMON = 1
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
INPUT_TDS = $(PROJ_SRC_DIR)/StmtNodes.td
|
||||
$(ObjDir)/Attrs.inc.tmp : $(TD_SRC_DIR)/Attr.td $(TBLGEN) \
|
||||
$(ObjDir)/.dir
|
||||
$(Echo) "Building Clang attribute classes with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-attr-classes -o $(call SYSPATH, $@) \
|
||||
-I $(PROJ_SRC_DIR)/../../ $<
|
||||
|
||||
$(ObjDir)/StmtNodes.inc.tmp : StmtNodes.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(ObjDir)/StmtNodes.inc.tmp : $(TD_SRC_DIR)/StmtNodes.td $(TBLGEN) \
|
||||
$(ObjDir)/.dir
|
||||
$(Echo) "Building Clang statement node tables with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-stmt-nodes -o $(call SYSPATH, $@) $<
|
||||
|
||||
$(ObjDir)/DeclNodes.inc.tmp : $(TD_SRC_DIR)/DeclNodes.td $(TBLGEN) \
|
||||
$(ObjDir)/.dir
|
||||
$(Echo) "Building Clang declaration node tables with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-decl-nodes -o $(call SYSPATH, $@) $<
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -92,6 +92,11 @@ public:
|
||||
return D;
|
||||
}
|
||||
|
||||
/// \brief Returns true if this is the first declaration.
|
||||
bool isFirstDeclaration() const {
|
||||
return RedeclLink.NextIsLatest();
|
||||
}
|
||||
|
||||
/// \brief Returns the most recent (re)declaration of this declaration.
|
||||
decl_type *getMostRecentDeclaration() {
|
||||
return getFirstDeclaration()->RedeclLink.getNext();
|
||||
|
@ -99,11 +99,9 @@ public:
|
||||
NoStmtClass = 0,
|
||||
#define STMT(CLASS, PARENT) CLASS##Class,
|
||||
#define STMT_RANGE(BASE, FIRST, LAST) \
|
||||
first##BASE##Constant = FIRST##Class, \
|
||||
last##BASE##Constant = LAST##Class,
|
||||
first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
|
||||
#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
|
||||
first##BASE##Constant = FIRST##Class, \
|
||||
last##BASE##Constant = LAST##Class
|
||||
first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
|
||||
#define ABSTRACT_STMT(STMT)
|
||||
#include "clang/AST/StmtNodes.inc"
|
||||
};
|
||||
@ -617,24 +615,16 @@ public:
|
||||
/// IfStmt - This represents an if/then/else.
|
||||
///
|
||||
class IfStmt : public Stmt {
|
||||
enum { COND, THEN, ELSE, END_EXPR };
|
||||
enum { VAR, COND, THEN, ELSE, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR];
|
||||
|
||||
/// \brief If non-NULL, the declaration in the "if" statement.
|
||||
VarDecl *Var;
|
||||
|
||||
SourceLocation IfLoc;
|
||||
SourceLocation ElseLoc;
|
||||
|
||||
public:
|
||||
IfStmt(SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then,
|
||||
SourceLocation EL = SourceLocation(), Stmt *elsev = 0)
|
||||
: Stmt(IfStmtClass), Var(var), IfLoc(IL), ElseLoc(EL) {
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[THEN] = then;
|
||||
SubExprs[ELSE] = elsev;
|
||||
}
|
||||
|
||||
IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
|
||||
Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
|
||||
|
||||
/// \brief Build an empty if/then/else statement
|
||||
explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) { }
|
||||
|
||||
@ -646,8 +636,8 @@ public:
|
||||
/// printf("x is %d", x);
|
||||
/// }
|
||||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return Var; }
|
||||
void setConditionVariable(VarDecl *V) { Var = V; }
|
||||
VarDecl *getConditionVariable() const;
|
||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
||||
|
||||
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
|
||||
void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
|
||||
@ -689,9 +679,8 @@ protected:
|
||||
/// SwitchStmt - This represents a 'switch' stmt.
|
||||
///
|
||||
class SwitchStmt : public Stmt {
|
||||
enum { COND, BODY, END_EXPR };
|
||||
enum { VAR, COND, BODY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR];
|
||||
VarDecl *Var;
|
||||
// This points to a linked list of case and default statements.
|
||||
SwitchCase *FirstCase;
|
||||
SourceLocation SwitchLoc;
|
||||
@ -700,12 +689,7 @@ protected:
|
||||
virtual void DoDestroy(ASTContext &Ctx);
|
||||
|
||||
public:
|
||||
SwitchStmt(VarDecl *Var, Expr *cond)
|
||||
: Stmt(SwitchStmtClass), Var(Var), FirstCase(0)
|
||||
{
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[BODY] = NULL;
|
||||
}
|
||||
SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond);
|
||||
|
||||
/// \brief Build a empty switch statement.
|
||||
explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { }
|
||||
@ -719,8 +703,8 @@ public:
|
||||
/// // ...
|
||||
/// }
|
||||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return Var; }
|
||||
void setConditionVariable(VarDecl *V) { Var = V; }
|
||||
VarDecl *getConditionVariable() const;
|
||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
||||
|
||||
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
|
||||
const Stmt *getBody() const { return SubExprs[BODY]; }
|
||||
@ -768,18 +752,12 @@ public:
|
||||
/// WhileStmt - This represents a 'while' stmt.
|
||||
///
|
||||
class WhileStmt : public Stmt {
|
||||
enum { COND, BODY, END_EXPR };
|
||||
VarDecl *Var;
|
||||
enum { VAR, COND, BODY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR];
|
||||
SourceLocation WhileLoc;
|
||||
public:
|
||||
WhileStmt(VarDecl *Var, Expr *cond, Stmt *body, SourceLocation WL)
|
||||
: Stmt(WhileStmtClass), Var(Var)
|
||||
{
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[BODY] = body;
|
||||
WhileLoc = WL;
|
||||
}
|
||||
WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
||||
SourceLocation WL);
|
||||
|
||||
/// \brief Build an empty while statement.
|
||||
explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) { }
|
||||
@ -792,8 +770,8 @@ public:
|
||||
/// // ...
|
||||
/// }
|
||||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return Var; }
|
||||
void setConditionVariable(VarDecl *V) { Var = V; }
|
||||
VarDecl *getConditionVariable() const;
|
||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
||||
|
||||
Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
|
||||
const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
|
||||
@ -875,23 +853,14 @@ public:
|
||||
/// specified in the source.
|
||||
///
|
||||
class ForStmt : public Stmt {
|
||||
enum { INIT, COND, INC, BODY, END_EXPR };
|
||||
enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
|
||||
Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
|
||||
VarDecl *CondVar;
|
||||
SourceLocation ForLoc;
|
||||
SourceLocation LParenLoc, RParenLoc;
|
||||
|
||||
public:
|
||||
ForStmt(Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body,
|
||||
SourceLocation FL, SourceLocation LP, SourceLocation RP)
|
||||
: Stmt(ForStmtClass), CondVar(condVar), ForLoc(FL), LParenLoc(LP),
|
||||
RParenLoc(RP)
|
||||
{
|
||||
SubExprs[INIT] = Init;
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(Cond);
|
||||
SubExprs[INC] = reinterpret_cast<Stmt*>(Inc);
|
||||
SubExprs[BODY] = Body;
|
||||
}
|
||||
ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc,
|
||||
Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP);
|
||||
|
||||
/// \brief Build an empty for statement.
|
||||
explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
|
||||
@ -906,8 +875,8 @@ public:
|
||||
/// // ...
|
||||
/// }
|
||||
/// \endcode
|
||||
VarDecl *getConditionVariable() const { return CondVar; }
|
||||
void setConditionVariable(VarDecl *V) { CondVar = V; }
|
||||
VarDecl *getConditionVariable() const;
|
||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
||||
|
||||
Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
|
||||
Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "llvm/System/DataTypes.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
namespace clang {
|
||||
|
@ -256,6 +256,10 @@ public:
|
||||
return Args.NumArgs;
|
||||
}
|
||||
|
||||
/// Determines whether two template arguments are superficially the
|
||||
/// same.
|
||||
bool structurallyEquals(const TemplateArgument &Other) const;
|
||||
|
||||
/// \brief Construct a template argument pack.
|
||||
void setArgumentPack(TemplateArgument *Args, unsigned NumArgs, bool CopyArgs);
|
||||
|
||||
@ -476,6 +480,28 @@ public:
|
||||
|
||||
const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
const TemplateArgument &Arg);
|
||||
|
||||
inline TemplateSpecializationType::iterator
|
||||
TemplateSpecializationType::end() const {
|
||||
return getArgs() + getNumArgs();
|
||||
}
|
||||
|
||||
inline DependentTemplateSpecializationType::iterator
|
||||
DependentTemplateSpecializationType::end() const {
|
||||
return getArgs() + getNumArgs();
|
||||
}
|
||||
|
||||
inline const TemplateArgument &
|
||||
TemplateSpecializationType::getArg(unsigned Idx) const {
|
||||
assert(Idx < getNumArgs() && "Template argument out of range");
|
||||
return getArgs()[Idx];
|
||||
}
|
||||
|
||||
inline const TemplateArgument &
|
||||
DependentTemplateSpecializationType::getArg(unsigned Idx) const {
|
||||
assert(Idx < getNumArgs() && "Template argument out of range");
|
||||
return getArgs()[Idx];
|
||||
}
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
|
@ -101,6 +101,14 @@ class TemplateName {
|
||||
}
|
||||
|
||||
public:
|
||||
// \brief Kind of name that is actually stored.
|
||||
enum NameKind {
|
||||
Template,
|
||||
OverloadedTemplate,
|
||||
QualifiedTemplate,
|
||||
DependentTemplate
|
||||
};
|
||||
|
||||
TemplateName() : Storage() { }
|
||||
explicit TemplateName(TemplateDecl *Template) : Storage(Template) { }
|
||||
explicit TemplateName(OverloadedTemplateStorage *Storage)
|
||||
@ -110,6 +118,9 @@ public:
|
||||
|
||||
/// \brief Determine whether this template name is NULL.
|
||||
bool isNull() const { return Storage.isNull(); }
|
||||
|
||||
// \brief Get the kind of name that is actually stored.
|
||||
NameKind getKind() const;
|
||||
|
||||
/// \brief Retrieve the the underlying template declaration that
|
||||
/// this template name refers to, if known.
|
||||
|
@ -271,6 +271,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool isSupersetOf(Qualifiers Other) const;
|
||||
|
||||
bool operator==(Qualifiers Other) const { return Mask == Other.Mask; }
|
||||
bool operator!=(Qualifiers Other) const { return Mask != Other.Mask; }
|
||||
|
||||
@ -627,6 +629,14 @@ public:
|
||||
bool isAtLeastAsQualifiedAs(QualType Other) const;
|
||||
QualType getNonReferenceType() const;
|
||||
|
||||
/// \brief Determine the type of an expression that calls a function of
|
||||
/// with the given result type.
|
||||
///
|
||||
/// This routine removes a top-level reference (since there are no
|
||||
/// expressions of reference type) and deletes top-level cvr-qualifiers
|
||||
/// from non-class types (in C++) or all types (in C).
|
||||
QualType getCallResultType(ASTContext &Context) const;
|
||||
|
||||
/// getDesugaredType - Return the specified type with any "sugar" removed from
|
||||
/// the type. This takes off typedefs, typeof's etc. If the outer level of
|
||||
/// the type is already concrete, it returns it unmodified. This is similar
|
||||
@ -835,6 +845,9 @@ public:
|
||||
/// Helper methods to distinguish type categories. All type predicates
|
||||
/// operate on the canonical type, ignoring typedefs and qualifiers.
|
||||
|
||||
/// isBuiltinType - returns true if the type is a builtin type.
|
||||
bool isBuiltinType() const;
|
||||
|
||||
/// isSpecificBuiltinType - Test for a particular builtin type.
|
||||
bool isSpecificBuiltinType(unsigned K) const;
|
||||
|
||||
@ -846,8 +859,11 @@ public:
|
||||
bool isCharType() const;
|
||||
bool isWideCharType() const;
|
||||
bool isAnyCharacterType() const;
|
||||
bool isIntegralType() const;
|
||||
bool isIntegralType(ASTContext &Ctx) const;
|
||||
|
||||
/// \brief Determine whether this type is an integral or enumeration type.
|
||||
bool isIntegralOrEnumerationType() const;
|
||||
|
||||
/// Floating point categories.
|
||||
bool isRealFloatingType() const; // C99 6.2.5p10 (float, double, long double)
|
||||
/// isComplexType() does *not* include complex integers (a GCC extension).
|
||||
@ -923,6 +939,10 @@ public:
|
||||
/// an objective pointer type for the purpose of GC'ability
|
||||
bool hasObjCPointerRepresentation() const;
|
||||
|
||||
/// \brief Determine whether this type has a floating-point representation
|
||||
/// of some sort, e.g., it is a floating-point type or a vector thereof.
|
||||
bool hasFloatingRepresentation() const;
|
||||
|
||||
// Type Checking Functions: Check to see if this type is structurally the
|
||||
// specified type, ignoring typedefs and qualifiers, and return a pointer to
|
||||
// the best type we can.
|
||||
@ -1001,6 +1021,9 @@ public:
|
||||
CanQualType getCanonicalTypeUnqualified() const; // in CanonicalType.h
|
||||
void dump() const;
|
||||
static bool classof(const Type *) { return true; }
|
||||
|
||||
friend class PCHReader;
|
||||
friend class PCHWriter;
|
||||
};
|
||||
|
||||
template <> inline const TypedefType *Type::getAs() const {
|
||||
@ -1640,6 +1663,13 @@ public:
|
||||
/// Since the constructor takes the number of vector elements, the
|
||||
/// client is responsible for converting the size into the number of elements.
|
||||
class VectorType : public Type, public llvm::FoldingSetNode {
|
||||
public:
|
||||
enum AltiVecSpecific {
|
||||
NotAltiVec, // is not AltiVec vector
|
||||
AltiVec, // is AltiVec vector
|
||||
Pixel, // is AltiVec 'vector Pixel'
|
||||
Bool // is AltiVec 'vector bool ...'
|
||||
};
|
||||
protected:
|
||||
/// ElementType - The element type of the vector.
|
||||
QualType ElementType;
|
||||
@ -1647,21 +1677,16 @@ protected:
|
||||
/// NumElements - The number of elements in the vector.
|
||||
unsigned NumElements;
|
||||
|
||||
/// AltiVec - True if this is for an Altivec vector.
|
||||
bool AltiVec;
|
||||
|
||||
/// Pixel - True if this is for an Altivec vector pixel.
|
||||
bool Pixel;
|
||||
AltiVecSpecific AltiVecSpec;
|
||||
|
||||
VectorType(QualType vecType, unsigned nElements, QualType canonType,
|
||||
bool isAltiVec, bool isPixel) :
|
||||
AltiVecSpecific altiVecSpec) :
|
||||
Type(Vector, canonType, vecType->isDependentType()),
|
||||
ElementType(vecType), NumElements(nElements),
|
||||
AltiVec(isAltiVec), Pixel(isPixel) {}
|
||||
ElementType(vecType), NumElements(nElements), AltiVecSpec(altiVecSpec) {}
|
||||
VectorType(TypeClass tc, QualType vecType, unsigned nElements,
|
||||
QualType canonType, bool isAltiVec, bool isPixel)
|
||||
QualType canonType, AltiVecSpecific altiVecSpec)
|
||||
: Type(tc, canonType, vecType->isDependentType()), ElementType(vecType),
|
||||
NumElements(nElements), AltiVec(isAltiVec), Pixel(isPixel) {}
|
||||
NumElements(nElements), AltiVecSpec(altiVecSpec) {}
|
||||
friend class ASTContext; // ASTContext creates these.
|
||||
|
||||
virtual Linkage getLinkageImpl() const;
|
||||
@ -1674,22 +1699,18 @@ public:
|
||||
bool isSugared() const { return false; }
|
||||
QualType desugar() const { return QualType(this, 0); }
|
||||
|
||||
bool isAltiVec() const { return AltiVec; }
|
||||
|
||||
bool isPixel() const { return Pixel; }
|
||||
|
||||
AltiVecSpecific getAltiVecSpecific() const { return AltiVecSpec; }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
Profile(ID, getElementType(), getNumElements(), getTypeClass(),
|
||||
AltiVec, Pixel);
|
||||
Profile(ID, getElementType(), getNumElements(), getTypeClass(), AltiVecSpec);
|
||||
}
|
||||
static void Profile(llvm::FoldingSetNodeID &ID, QualType ElementType,
|
||||
unsigned NumElements, TypeClass TypeClass,
|
||||
bool isAltiVec, bool isPixel) {
|
||||
unsigned AltiVecSpec) {
|
||||
ID.AddPointer(ElementType.getAsOpaquePtr());
|
||||
ID.AddInteger(NumElements);
|
||||
ID.AddInteger(TypeClass);
|
||||
ID.AddBoolean(isAltiVec);
|
||||
ID.AddBoolean(isPixel);
|
||||
ID.AddInteger(AltiVecSpec);
|
||||
}
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
@ -1705,7 +1726,7 @@ public:
|
||||
/// points, colors, and textures (modeled after OpenGL Shading Language).
|
||||
class ExtVectorType : public VectorType {
|
||||
ExtVectorType(QualType vecType, unsigned nElements, QualType canonType) :
|
||||
VectorType(ExtVector, vecType, nElements, canonType, false, false) {}
|
||||
VectorType(ExtVector, vecType, nElements, canonType, NotAltiVec) {}
|
||||
friend class ASTContext; // ASTContext creates these.
|
||||
public:
|
||||
static int getPointAccessorIdx(char c) {
|
||||
@ -1875,6 +1896,7 @@ protected:
|
||||
public:
|
||||
|
||||
QualType getResultType() const { return ResultType; }
|
||||
|
||||
unsigned getRegParmType() const { return RegParm; }
|
||||
bool getNoReturnAttr() const { return NoReturn; }
|
||||
CallingConv getCallConv() const { return (CallingConv)CallConv; }
|
||||
@ -1882,6 +1904,12 @@ public:
|
||||
return ExtInfo(NoReturn, RegParm, (CallingConv)CallConv);
|
||||
}
|
||||
|
||||
/// \brief Determine the type of an expression that calls a function of
|
||||
/// this type.
|
||||
QualType getCallResultType(ASTContext &Context) const {
|
||||
return getResultType().getCallResultType(Context);
|
||||
}
|
||||
|
||||
static llvm::StringRef getNameForCallConv(CallingConv CC);
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
@ -2416,23 +2444,14 @@ public:
|
||||
/// dependent.
|
||||
class TemplateSpecializationType
|
||||
: public Type, public llvm::FoldingSetNode {
|
||||
|
||||
// The ASTContext is currently needed in order to profile expressions.
|
||||
// FIXME: avoid this.
|
||||
//
|
||||
// The bool is whether this is a current instantiation.
|
||||
llvm::PointerIntPair<ASTContext*, 1, bool> ContextAndCurrentInstantiation;
|
||||
|
||||
/// \brief The name of the template being specialized.
|
||||
/// \brief The name of the template being specialized.
|
||||
TemplateName Template;
|
||||
|
||||
/// \brief - The number of template arguments named in this class
|
||||
/// template specialization.
|
||||
unsigned NumArgs;
|
||||
|
||||
TemplateSpecializationType(ASTContext &Context,
|
||||
TemplateName T,
|
||||
bool IsCurrentInstantiation,
|
||||
TemplateSpecializationType(TemplateName T,
|
||||
const TemplateArgument *Args,
|
||||
unsigned NumArgs, QualType Canon);
|
||||
|
||||
@ -2467,13 +2486,13 @@ public:
|
||||
/// True if this template specialization type matches a current
|
||||
/// instantiation in the context in which it is found.
|
||||
bool isCurrentInstantiation() const {
|
||||
return ContextAndCurrentInstantiation.getInt();
|
||||
return isa<InjectedClassNameType>(getCanonicalTypeInternal());
|
||||
}
|
||||
|
||||
typedef const TemplateArgument * iterator;
|
||||
|
||||
iterator begin() const { return getArgs(); }
|
||||
iterator end() const;
|
||||
iterator end() const; // defined inline in TemplateBase.h
|
||||
|
||||
/// \brief Retrieve the name of the template that we are specializing.
|
||||
TemplateName getTemplateName() const { return Template; }
|
||||
@ -2488,20 +2507,18 @@ public:
|
||||
|
||||
/// \brief Retrieve a specific template argument as a type.
|
||||
/// \precondition @c isArgType(Arg)
|
||||
const TemplateArgument &getArg(unsigned Idx) const;
|
||||
const TemplateArgument &getArg(unsigned Idx) const; // in TemplateBase.h
|
||||
|
||||
bool isSugared() const {
|
||||
return !isDependentType() || isCurrentInstantiation();
|
||||
}
|
||||
QualType desugar() const { return getCanonicalTypeInternal(); }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
Profile(ID, Template, isCurrentInstantiation(), getArgs(), NumArgs,
|
||||
*ContextAndCurrentInstantiation.getPointer());
|
||||
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Ctx) {
|
||||
Profile(ID, Template, getArgs(), NumArgs, Ctx);
|
||||
}
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID, TemplateName T,
|
||||
bool IsCurrentInstantiation,
|
||||
const TemplateArgument *Args,
|
||||
unsigned NumArgs,
|
||||
ASTContext &Context);
|
||||
@ -2545,6 +2562,9 @@ class InjectedClassNameType : public Type {
|
||||
|
||||
friend class ASTContext; // ASTContext creates these.
|
||||
friend class TagDecl; // TagDecl mutilates the Decl
|
||||
friend class PCHReader; // FIXME: ASTContext::getInjectedClassNameType is not
|
||||
// currently suitable for PCH reading, too much
|
||||
// interdependencies.
|
||||
InjectedClassNameType(CXXRecordDecl *D, QualType TST)
|
||||
: Type(InjectedClassName, QualType(), true),
|
||||
Decl(D), InjectedType(TST) {
|
||||
@ -2679,6 +2699,7 @@ class ElaboratedType : public TypeWithKeyword, public llvm::FoldingSetNode {
|
||||
friend class ASTContext; // ASTContext creates these
|
||||
|
||||
public:
|
||||
~ElaboratedType();
|
||||
|
||||
/// \brief Retrieve the qualification on this type.
|
||||
NestedNameSpecifier *getQualifier() const { return NNS; }
|
||||
@ -2723,11 +2744,8 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
|
||||
/// \brief The nested name specifier containing the qualifier.
|
||||
NestedNameSpecifier *NNS;
|
||||
|
||||
typedef llvm::PointerUnion<const IdentifierInfo *,
|
||||
const TemplateSpecializationType *> NameType;
|
||||
|
||||
/// \brief The type that this typename specifier refers to.
|
||||
NameType Name;
|
||||
const IdentifierInfo *Name;
|
||||
|
||||
DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name, QualType CanonType)
|
||||
@ -2737,17 +2755,10 @@ class DependentNameType : public TypeWithKeyword, public llvm::FoldingSetNode {
|
||||
"DependentNameType requires a dependent nested-name-specifier");
|
||||
}
|
||||
|
||||
DependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS,
|
||||
const TemplateSpecializationType *Ty, QualType CanonType)
|
||||
: TypeWithKeyword(Keyword, DependentName, CanonType, true),
|
||||
NNS(NNS), Name(Ty) {
|
||||
assert(NNS->isDependent() &&
|
||||
"DependentNameType requires a dependent nested-name-specifier");
|
||||
}
|
||||
|
||||
friend class ASTContext; // ASTContext creates these
|
||||
|
||||
public:
|
||||
virtual ~DependentNameType();
|
||||
|
||||
/// \brief Retrieve the qualification on this type.
|
||||
NestedNameSpecifier *getQualifier() const { return NNS; }
|
||||
@ -2759,13 +2770,7 @@ public:
|
||||
/// form of the original typename was terminated by an identifier,
|
||||
/// e.g., "typename T::type".
|
||||
const IdentifierInfo *getIdentifier() const {
|
||||
return Name.dyn_cast<const IdentifierInfo *>();
|
||||
}
|
||||
|
||||
/// \brief Retrieve the type named by the typename specifier as a
|
||||
/// type specialization.
|
||||
const TemplateSpecializationType *getTemplateId() const {
|
||||
return Name.dyn_cast<const TemplateSpecializationType *>();
|
||||
return Name;
|
||||
}
|
||||
|
||||
bool isSugared() const { return false; }
|
||||
@ -2776,10 +2781,10 @@ public:
|
||||
}
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *NNS, NameType Name) {
|
||||
NestedNameSpecifier *NNS, const IdentifierInfo *Name) {
|
||||
ID.AddInteger(Keyword);
|
||||
ID.AddPointer(NNS);
|
||||
ID.AddPointer(Name.getOpaqueValue());
|
||||
ID.AddPointer(Name);
|
||||
}
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
@ -2788,6 +2793,83 @@ public:
|
||||
static bool classof(const DependentNameType *T) { return true; }
|
||||
};
|
||||
|
||||
/// DependentTemplateSpecializationType - Represents a template
|
||||
/// specialization type whose template cannot be resolved, e.g.
|
||||
/// A<T>::template B<T>
|
||||
class DependentTemplateSpecializationType :
|
||||
public TypeWithKeyword, public llvm::FoldingSetNode {
|
||||
|
||||
/// \brief The nested name specifier containing the qualifier.
|
||||
NestedNameSpecifier *NNS;
|
||||
|
||||
/// \brief The identifier of the template.
|
||||
const IdentifierInfo *Name;
|
||||
|
||||
/// \brief - The number of template arguments named in this class
|
||||
/// template specialization.
|
||||
unsigned NumArgs;
|
||||
|
||||
const TemplateArgument *getArgBuffer() const {
|
||||
return reinterpret_cast<const TemplateArgument*>(this+1);
|
||||
}
|
||||
TemplateArgument *getArgBuffer() {
|
||||
return reinterpret_cast<TemplateArgument*>(this+1);
|
||||
}
|
||||
|
||||
DependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *NNS,
|
||||
const IdentifierInfo *Name,
|
||||
unsigned NumArgs,
|
||||
const TemplateArgument *Args,
|
||||
QualType Canon);
|
||||
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
friend class ASTContext; // ASTContext creates these
|
||||
|
||||
public:
|
||||
virtual ~DependentTemplateSpecializationType();
|
||||
|
||||
NestedNameSpecifier *getQualifier() const { return NNS; }
|
||||
const IdentifierInfo *getIdentifier() const { return Name; }
|
||||
|
||||
/// \brief Retrieve the template arguments.
|
||||
const TemplateArgument *getArgs() const {
|
||||
return getArgBuffer();
|
||||
}
|
||||
|
||||
/// \brief Retrieve the number of template arguments.
|
||||
unsigned getNumArgs() const { return NumArgs; }
|
||||
|
||||
const TemplateArgument &getArg(unsigned Idx) const; // in TemplateBase.h
|
||||
|
||||
typedef const TemplateArgument * iterator;
|
||||
iterator begin() const { return getArgs(); }
|
||||
iterator end() const; // inline in TemplateBase.h
|
||||
|
||||
bool isSugared() const { return false; }
|
||||
QualType desugar() const { return QualType(this, 0); }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context) {
|
||||
Profile(ID, Context, getKeyword(), NNS, Name, NumArgs, getArgs());
|
||||
}
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID &ID,
|
||||
ASTContext &Context,
|
||||
ElaboratedTypeKeyword Keyword,
|
||||
NestedNameSpecifier *Qualifier,
|
||||
const IdentifierInfo *Name,
|
||||
unsigned NumArgs,
|
||||
const TemplateArgument *Args);
|
||||
|
||||
static bool classof(const Type *T) {
|
||||
return T->getTypeClass() == DependentTemplateSpecialization;
|
||||
}
|
||||
static bool classof(const DependentTemplateSpecializationType *T) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/// ObjCObjectType - Represents a class type in Objective C.
|
||||
/// Every Objective C type is a combination of a base type and a
|
||||
/// list of protocols.
|
||||
@ -3310,6 +3392,12 @@ inline FunctionType::ExtInfo getFunctionExtInfo(QualType t) {
|
||||
return getFunctionExtInfo(*t);
|
||||
}
|
||||
|
||||
/// \brief Determine whether this set of qualifiers is a superset of the given
|
||||
/// set of qualifiers.
|
||||
inline bool Qualifiers::isSupersetOf(Qualifiers Other) const {
|
||||
return Mask != Other.Mask && (Mask | Other.Mask) == Mask;
|
||||
}
|
||||
|
||||
/// isMoreQualifiedThan - Determine whether this type is more
|
||||
/// qualified than the Other type. For example, "const volatile int"
|
||||
/// is more qualified than "const int", "volatile int", and
|
||||
@ -3454,6 +3542,10 @@ inline bool Type::isTemplateTypeParmType() const {
|
||||
return isa<TemplateTypeParmType>(CanonicalType);
|
||||
}
|
||||
|
||||
inline bool Type::isBuiltinType() const {
|
||||
return getAs<BuiltinType>();
|
||||
}
|
||||
|
||||
inline bool Type::isSpecificBuiltinType(unsigned K) const {
|
||||
if (const BuiltinType *BT = getAs<BuiltinType>())
|
||||
if (BT->getKind() == (BuiltinType::Kind) K)
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
|
||||
/// \brief Return the TypeLoc for a type source info.
|
||||
inline TypeLoc TypeSourceInfo::getTypeLoc() const {
|
||||
return TypeLoc(Ty, (void*)(this + 1));
|
||||
return TypeLoc(Ty, const_cast<void*>(static_cast<const void*>(this + 1)));
|
||||
}
|
||||
|
||||
/// \brief Wrapper of type source information for a type with
|
||||
@ -657,7 +657,7 @@ struct ObjCInterfaceLocInfo {
|
||||
};
|
||||
|
||||
/// \brief Wrapper for source info for ObjC interfaces.
|
||||
class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc,
|
||||
class ObjCInterfaceTypeLoc : public ConcreteTypeLoc<ObjCObjectTypeLoc,
|
||||
ObjCInterfaceTypeLoc,
|
||||
ObjCInterfaceType,
|
||||
ObjCInterfaceLocInfo> {
|
||||
@ -1033,13 +1033,20 @@ public:
|
||||
setLAngleLoc(Loc);
|
||||
setRAngleLoc(Loc);
|
||||
setTemplateNameLoc(Loc);
|
||||
initializeArgLocs(getNumArgs(), getTypePtr()->getArgs(),
|
||||
getArgInfos(), Loc);
|
||||
}
|
||||
|
||||
for (unsigned i = 0, e = getNumArgs(); i != e; ++i) {
|
||||
static void initializeArgLocs(unsigned NumArgs,
|
||||
const TemplateArgument *Args,
|
||||
TemplateArgumentLocInfo *ArgInfos,
|
||||
SourceLocation Loc) {
|
||||
for (unsigned i = 0, e = NumArgs; i != e; ++i) {
|
||||
TemplateArgumentLocInfo Info;
|
||||
#ifndef NDEBUG
|
||||
// If asserts are enabled, be sure to initialize the argument
|
||||
// loc with the right kind of pointer.
|
||||
switch (getTypePtr()->getArg(i).getKind()) {
|
||||
switch (Args[i].getKind()) {
|
||||
case TemplateArgument::Expression:
|
||||
case TemplateArgument::Declaration:
|
||||
Info = TemplateArgumentLocInfo((Expr*) 0);
|
||||
@ -1050,7 +1057,7 @@ public:
|
||||
break;
|
||||
|
||||
case TemplateArgument::Template:
|
||||
Info = TemplateArgumentLocInfo(SourceRange(), SourceLocation());
|
||||
Info = TemplateArgumentLocInfo(SourceRange(Loc), Loc);
|
||||
break;
|
||||
|
||||
case TemplateArgument::Integral:
|
||||
@ -1060,7 +1067,7 @@ public:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
getArgInfos()[i] = Info;
|
||||
ArgInfos[i] = Info;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1251,9 +1258,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct DependentNameLocInfo {
|
||||
SourceLocation KeywordLoc;
|
||||
SourceRange QualifierRange;
|
||||
// This is exactly the structure of an ElaboratedTypeLoc whose inner
|
||||
// type is some sort of TypeDeclTypeLoc.
|
||||
struct DependentNameLocInfo : ElaboratedLocInfo {
|
||||
SourceLocation NameLoc;
|
||||
};
|
||||
|
||||
@ -1303,6 +1310,107 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// This is exactly the structure of an ElaboratedTypeLoc whose inner
|
||||
// type is some sort of TemplateSpecializationTypeLoc.
|
||||
struct DependentTemplateSpecializationLocInfo : DependentNameLocInfo {
|
||||
SourceLocation LAngleLoc;
|
||||
SourceLocation RAngleLoc;
|
||||
// followed by a TemplateArgumentLocInfo[]
|
||||
};
|
||||
|
||||
class DependentTemplateSpecializationTypeLoc :
|
||||
public ConcreteTypeLoc<UnqualTypeLoc,
|
||||
DependentTemplateSpecializationTypeLoc,
|
||||
DependentTemplateSpecializationType,
|
||||
DependentTemplateSpecializationLocInfo> {
|
||||
public:
|
||||
SourceLocation getKeywordLoc() const {
|
||||
return this->getLocalData()->KeywordLoc;
|
||||
}
|
||||
void setKeywordLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->KeywordLoc = Loc;
|
||||
}
|
||||
|
||||
SourceRange getQualifierRange() const {
|
||||
return this->getLocalData()->QualifierRange;
|
||||
}
|
||||
void setQualifierRange(SourceRange Range) {
|
||||
this->getLocalData()->QualifierRange = Range;
|
||||
}
|
||||
|
||||
SourceLocation getNameLoc() const {
|
||||
return this->getLocalData()->NameLoc;
|
||||
}
|
||||
void setNameLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->NameLoc = Loc;
|
||||
}
|
||||
|
||||
SourceLocation getLAngleLoc() const {
|
||||
return this->getLocalData()->LAngleLoc;
|
||||
}
|
||||
void setLAngleLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->LAngleLoc = Loc;
|
||||
}
|
||||
|
||||
SourceLocation getRAngleLoc() const {
|
||||
return this->getLocalData()->RAngleLoc;
|
||||
}
|
||||
void setRAngleLoc(SourceLocation Loc) {
|
||||
this->getLocalData()->RAngleLoc = Loc;
|
||||
}
|
||||
|
||||
unsigned getNumArgs() const {
|
||||
return getTypePtr()->getNumArgs();
|
||||
}
|
||||
|
||||
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI) {
|
||||
#ifndef NDEBUG
|
||||
AI.validateForArgument(getTypePtr()->getArg(i));
|
||||
#endif
|
||||
getArgInfos()[i] = AI;
|
||||
}
|
||||
TemplateArgumentLocInfo getArgLocInfo(unsigned i) const {
|
||||
return getArgInfos()[i];
|
||||
}
|
||||
|
||||
TemplateArgumentLoc getArgLoc(unsigned i) const {
|
||||
return TemplateArgumentLoc(getTypePtr()->getArg(i), getArgLocInfo(i));
|
||||
}
|
||||
|
||||
SourceRange getLocalSourceRange() const {
|
||||
if (getKeywordLoc().isValid())
|
||||
return SourceRange(getKeywordLoc(), getRAngleLoc());
|
||||
else
|
||||
return SourceRange(getQualifierRange().getBegin(), getRAngleLoc());
|
||||
}
|
||||
|
||||
void copy(DependentTemplateSpecializationTypeLoc Loc) {
|
||||
unsigned size = getFullDataSize();
|
||||
assert(size == Loc.getFullDataSize());
|
||||
memcpy(Data, Loc.Data, size);
|
||||
}
|
||||
|
||||
void initializeLocal(SourceLocation Loc) {
|
||||
setKeywordLoc(Loc);
|
||||
setQualifierRange(SourceRange(Loc));
|
||||
setNameLoc(Loc);
|
||||
setLAngleLoc(Loc);
|
||||
setRAngleLoc(Loc);
|
||||
TemplateSpecializationTypeLoc::initializeArgLocs(getNumArgs(),
|
||||
getTypePtr()->getArgs(),
|
||||
getArgInfos(), Loc);
|
||||
}
|
||||
|
||||
unsigned getExtraLocalDataSize() const {
|
||||
return getNumArgs() * sizeof(TemplateArgumentLocInfo);
|
||||
}
|
||||
|
||||
private:
|
||||
TemplateArgumentLocInfo *getArgInfos() const {
|
||||
return static_cast<TemplateArgumentLocInfo*>(getExtraLocalData());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -79,7 +79,14 @@ class TypeLocBuilder {
|
||||
size_t LocalSize = TypeSpecTypeLoc::LocalDataSize;
|
||||
return cast<TypeSpecTypeLoc>(pushImpl(T, LocalSize));
|
||||
}
|
||||
|
||||
|
||||
/// Resets this builder to the newly-initialized state.
|
||||
void clear() {
|
||||
#ifndef NDEBUG
|
||||
LastTy = QualType();
|
||||
#endif
|
||||
Index = Capacity;
|
||||
}
|
||||
|
||||
/// Pushes space for a new TypeLoc of the given type. Invalidates
|
||||
/// any TypeLocs previously retrieved from this builder.
|
||||
|
@ -92,6 +92,7 @@ NON_CANONICAL_TYPE(SubstTemplateTypeParm, Type)
|
||||
NON_CANONICAL_UNLESS_DEPENDENT_TYPE(TemplateSpecialization, Type)
|
||||
DEPENDENT_TYPE(InjectedClassName, Type)
|
||||
DEPENDENT_TYPE(DependentName, Type)
|
||||
DEPENDENT_TYPE(DependentTemplateSpecialization, Type)
|
||||
TYPE(ObjCObject, Type)
|
||||
TYPE(ObjCInterface, ObjCObjectType)
|
||||
TYPE(ObjCObjectPointer, Type)
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
typedef const T **iterator;
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
size_t size() const;
|
||||
|
||||
void push_back(T *Method);
|
||||
void Destroy();
|
||||
@ -56,7 +57,6 @@ UsuallyTinyPtrVector<T>::begin() const {
|
||||
return &Vec->front();
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
typename UsuallyTinyPtrVector<T>::iterator
|
||||
UsuallyTinyPtrVector<T>::end() const {
|
||||
@ -71,6 +71,15 @@ UsuallyTinyPtrVector<T>::end() const {
|
||||
return &Vec->front() + Vec->size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
size_t UsuallyTinyPtrVector<T>::size() const {
|
||||
if ((Storage & 0x01) == 0)
|
||||
return (Storage == 0) ? 0 : 1;
|
||||
|
||||
vector_type *Vec = reinterpret_cast<vector_type *>(Storage & ~0x01);
|
||||
return Vec->size();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void UsuallyTinyPtrVector<T>::push_back(T *Element) {
|
||||
if (Storage == 0) {
|
||||
|
@ -25,8 +25,8 @@ namespace analyze_printf {
|
||||
|
||||
class ArgTypeResult {
|
||||
public:
|
||||
enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CStrTy,
|
||||
WCStrTy };
|
||||
enum Kind { UnknownTy, InvalidTy, SpecificTy, ObjCPointerTy, CPointerTy,
|
||||
CStrTy, WCStrTy };
|
||||
private:
|
||||
const Kind K;
|
||||
QualType T;
|
||||
@ -57,6 +57,7 @@ public:
|
||||
InvalidSpecifier = 0,
|
||||
// C99 conversion specifiers.
|
||||
dArg, // 'd'
|
||||
IntAsCharArg, // 'c'
|
||||
iArg, // 'i',
|
||||
oArg, // 'o',
|
||||
uArg, // 'u',
|
||||
@ -70,7 +71,6 @@ public:
|
||||
GArg, // 'G',
|
||||
aArg, // 'a',
|
||||
AArg, // 'A',
|
||||
IntAsCharArg, // 'c'
|
||||
CStrArg, // 's'
|
||||
VoidPtrArg, // 'p'
|
||||
OutIntPtrArg, // 'n'
|
||||
@ -124,45 +124,87 @@ public:
|
||||
bool isUIntArg() const { return kind >= oArg && kind <= XArg; }
|
||||
bool isDoubleArg() const { return kind >= fArg && kind <= AArg; }
|
||||
Kind getKind() const { return kind; }
|
||||
void setKind(Kind k) { kind = k; }
|
||||
unsigned getLength() const {
|
||||
// Conversion specifiers currently only are represented by
|
||||
// single characters, but we be flexible.
|
||||
return 1;
|
||||
}
|
||||
const char *toString() const;
|
||||
|
||||
private:
|
||||
const char *Position;
|
||||
Kind kind;
|
||||
};
|
||||
|
||||
enum LengthModifier {
|
||||
None,
|
||||
AsChar, // 'hh'
|
||||
AsShort, // 'h'
|
||||
AsLong, // 'l'
|
||||
AsLongLong, // 'll', 'q' (BSD, deprecated)
|
||||
AsIntMax, // 'j'
|
||||
AsSizeT, // 'z'
|
||||
AsPtrDiff, // 't'
|
||||
AsLongDouble, // 'L'
|
||||
AsWideChar = AsLong // for '%ls'
|
||||
class LengthModifier {
|
||||
public:
|
||||
enum Kind {
|
||||
None,
|
||||
AsChar, // 'hh'
|
||||
AsShort, // 'h'
|
||||
AsLong, // 'l'
|
||||
AsLongLong, // 'll', 'q' (BSD, deprecated)
|
||||
AsIntMax, // 'j'
|
||||
AsSizeT, // 'z'
|
||||
AsPtrDiff, // 't'
|
||||
AsLongDouble, // 'L'
|
||||
AsWideChar = AsLong // for '%ls'
|
||||
};
|
||||
|
||||
LengthModifier()
|
||||
: Position(0), kind(None) {}
|
||||
LengthModifier(const char *pos, Kind k)
|
||||
: Position(pos), kind(k) {}
|
||||
|
||||
const char *getStart() const {
|
||||
return Position;
|
||||
}
|
||||
|
||||
unsigned getLength() const {
|
||||
switch (kind) {
|
||||
default:
|
||||
return 1;
|
||||
case AsLongLong:
|
||||
case AsChar:
|
||||
return 2;
|
||||
case None:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Kind getKind() const { return kind; }
|
||||
void setKind(Kind k) { kind = k; }
|
||||
|
||||
const char *toString() const;
|
||||
|
||||
private:
|
||||
const char *Position;
|
||||
Kind kind;
|
||||
};
|
||||
|
||||
class OptionalAmount {
|
||||
public:
|
||||
enum HowSpecified { NotSpecified, Constant, Arg, Invalid };
|
||||
|
||||
OptionalAmount(HowSpecified h, unsigned i, const char *st)
|
||||
: start(st), hs(h), amt(i) {}
|
||||
OptionalAmount(HowSpecified howSpecified,
|
||||
unsigned amount,
|
||||
const char *amountStart,
|
||||
unsigned amountLength,
|
||||
bool usesPositionalArg)
|
||||
: start(amountStart), length(amountLength), hs(howSpecified), amt(amount),
|
||||
UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {}
|
||||
|
||||
OptionalAmount(bool b = true)
|
||||
: start(0), hs(b ? NotSpecified : Invalid), amt(0) {}
|
||||
OptionalAmount(bool valid = true)
|
||||
: start(0),length(0), hs(valid ? NotSpecified : Invalid), amt(0),
|
||||
UsesPositionalArg(0), UsesDotPrefix(0) {}
|
||||
|
||||
bool isInvalid() const {
|
||||
return hs == Invalid;
|
||||
}
|
||||
|
||||
HowSpecified getHowSpecified() const { return hs; }
|
||||
void setHowSpecified(HowSpecified h) { hs = h; }
|
||||
|
||||
bool hasDataArgument() const { return hs == Arg; }
|
||||
|
||||
@ -177,36 +219,87 @@ public:
|
||||
}
|
||||
|
||||
const char *getStart() const {
|
||||
return start;
|
||||
// We include the . character if it is given.
|
||||
return start - UsesDotPrefix;
|
||||
}
|
||||
|
||||
unsigned getConstantLength() const {
|
||||
assert(hs == Constant);
|
||||
return length + UsesDotPrefix;
|
||||
}
|
||||
|
||||
ArgTypeResult getArgType(ASTContext &Ctx) const;
|
||||
|
||||
void toString(llvm::raw_ostream &os) const;
|
||||
|
||||
bool usesPositionalArg() const { return (bool) UsesPositionalArg; }
|
||||
unsigned getPositionalArgIndex() const {
|
||||
assert(hasDataArgument());
|
||||
return amt + 1;
|
||||
}
|
||||
|
||||
bool usesDotPrefix() const { return UsesDotPrefix; }
|
||||
void setUsesDotPrefix() { UsesDotPrefix = true; }
|
||||
|
||||
private:
|
||||
const char *start;
|
||||
unsigned length;
|
||||
HowSpecified hs;
|
||||
unsigned amt;
|
||||
bool UsesPositionalArg : 1;
|
||||
bool UsesDotPrefix;
|
||||
};
|
||||
|
||||
// Class representing optional flags with location and representation
|
||||
// information.
|
||||
class OptionalFlag {
|
||||
public:
|
||||
OptionalFlag(const char *Representation)
|
||||
: representation(Representation), flag(false) {}
|
||||
bool isSet() { return flag; }
|
||||
void set() { flag = true; }
|
||||
void clear() { flag = false; }
|
||||
void setPosition(const char *position) {
|
||||
assert(position);
|
||||
this->position = position;
|
||||
}
|
||||
const char *getPosition() const {
|
||||
assert(position);
|
||||
return position;
|
||||
}
|
||||
const char *toString() const { return representation; }
|
||||
|
||||
// Overloaded operators for bool like qualities
|
||||
operator bool() const { return flag; }
|
||||
OptionalFlag& operator=(const bool &rhs) {
|
||||
flag = rhs;
|
||||
return *this; // Return a reference to myself.
|
||||
}
|
||||
private:
|
||||
const char *representation;
|
||||
const char *position;
|
||||
bool flag;
|
||||
};
|
||||
|
||||
class FormatSpecifier {
|
||||
LengthModifier LM;
|
||||
unsigned IsLeftJustified : 1;
|
||||
unsigned HasPlusPrefix : 1;
|
||||
unsigned HasSpacePrefix : 1;
|
||||
unsigned HasAlternativeForm : 1;
|
||||
unsigned HasLeadingZeroes : 1;
|
||||
OptionalFlag IsLeftJustified; // '-'
|
||||
OptionalFlag HasPlusPrefix; // '+'
|
||||
OptionalFlag HasSpacePrefix; // ' '
|
||||
OptionalFlag HasAlternativeForm; // '#'
|
||||
OptionalFlag HasLeadingZeroes; // '0'
|
||||
/// Positional arguments, an IEEE extension:
|
||||
/// IEEE Std 1003.1, 2004 Edition
|
||||
/// http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
|
||||
unsigned UsesPositionalArg : 1;
|
||||
bool UsesPositionalArg;
|
||||
unsigned argIndex;
|
||||
ConversionSpecifier CS;
|
||||
OptionalAmount FieldWidth;
|
||||
OptionalAmount Precision;
|
||||
public:
|
||||
FormatSpecifier() : LM(None),
|
||||
IsLeftJustified(0), HasPlusPrefix(0), HasSpacePrefix(0),
|
||||
HasAlternativeForm(0), HasLeadingZeroes(0), UsesPositionalArg(0),
|
||||
FormatSpecifier() :
|
||||
IsLeftJustified("-"), HasPlusPrefix("+"), HasSpacePrefix(" "),
|
||||
HasAlternativeForm("#"), HasLeadingZeroes("0"), UsesPositionalArg(false),
|
||||
argIndex(0) {}
|
||||
|
||||
static FormatSpecifier Parse(const char *beg, const char *end);
|
||||
@ -218,12 +311,27 @@ public:
|
||||
void setLengthModifier(LengthModifier lm) {
|
||||
LM = lm;
|
||||
}
|
||||
void setIsLeftJustified() { IsLeftJustified = 1; }
|
||||
void setHasPlusPrefix() { HasPlusPrefix = 1; }
|
||||
void setHasSpacePrefix() { HasSpacePrefix = 1; }
|
||||
void setHasAlternativeForm() { HasAlternativeForm = 1; }
|
||||
void setHasLeadingZeros() { HasLeadingZeroes = 1; }
|
||||
void setUsesPositionalArg() { UsesPositionalArg = 1; }
|
||||
void setIsLeftJustified(const char *position) {
|
||||
IsLeftJustified = true;
|
||||
IsLeftJustified.setPosition(position);
|
||||
}
|
||||
void setHasPlusPrefix(const char *position) {
|
||||
HasPlusPrefix = true;
|
||||
HasPlusPrefix.setPosition(position);
|
||||
}
|
||||
void setHasSpacePrefix(const char *position) {
|
||||
HasSpacePrefix = true;
|
||||
HasSpacePrefix.setPosition(position);
|
||||
}
|
||||
void setHasAlternativeForm(const char *position) {
|
||||
HasAlternativeForm = true;
|
||||
HasAlternativeForm.setPosition(position);
|
||||
}
|
||||
void setHasLeadingZeros(const char *position) {
|
||||
HasLeadingZeroes = true;
|
||||
HasLeadingZeroes.setPosition(position);
|
||||
}
|
||||
void setUsesPositionalArg() { UsesPositionalArg = true; }
|
||||
|
||||
void setArgIndex(unsigned i) {
|
||||
assert(CS.consumesDataArgument());
|
||||
@ -235,13 +343,18 @@ public:
|
||||
return argIndex;
|
||||
}
|
||||
|
||||
unsigned getPositionalArgIndex() const {
|
||||
assert(CS.consumesDataArgument());
|
||||
return argIndex + 1;
|
||||
}
|
||||
|
||||
// Methods for querying the format specifier.
|
||||
|
||||
const ConversionSpecifier &getConversionSpecifier() const {
|
||||
return CS;
|
||||
}
|
||||
|
||||
LengthModifier getLengthModifier() const {
|
||||
const LengthModifier &getLengthModifier() const {
|
||||
return LM;
|
||||
}
|
||||
|
||||
@ -255,6 +368,7 @@ public:
|
||||
|
||||
void setPrecision(const OptionalAmount &Amt) {
|
||||
Precision = Amt;
|
||||
Precision.setUsesDotPrefix();
|
||||
}
|
||||
|
||||
const OptionalAmount &getPrecision() const {
|
||||
@ -268,12 +382,30 @@ public:
|
||||
/// more than one type.
|
||||
ArgTypeResult getArgType(ASTContext &Ctx) const;
|
||||
|
||||
bool isLeftJustified() const { return (bool) IsLeftJustified; }
|
||||
bool hasPlusPrefix() const { return (bool) HasPlusPrefix; }
|
||||
bool hasAlternativeForm() const { return (bool) HasAlternativeForm; }
|
||||
bool hasLeadingZeros() const { return (bool) HasLeadingZeroes; }
|
||||
bool hasSpacePrefix() const { return (bool) HasSpacePrefix; }
|
||||
bool usesPositionalArg() const { return (bool) UsesPositionalArg; }
|
||||
const OptionalFlag &isLeftJustified() const { return IsLeftJustified; }
|
||||
const OptionalFlag &hasPlusPrefix() const { return HasPlusPrefix; }
|
||||
const OptionalFlag &hasAlternativeForm() const { return HasAlternativeForm; }
|
||||
const OptionalFlag &hasLeadingZeros() const { return HasLeadingZeroes; }
|
||||
const OptionalFlag &hasSpacePrefix() const { return HasSpacePrefix; }
|
||||
bool usesPositionalArg() const { return UsesPositionalArg; }
|
||||
|
||||
/// Changes the specifier and length according to a QualType, retaining any
|
||||
/// flags or options. Returns true on success, or false when a conversion
|
||||
/// was not successful.
|
||||
bool fixType(QualType QT);
|
||||
|
||||
void toString(llvm::raw_ostream &os) const;
|
||||
|
||||
// Validation methods - to check if any element results in undefined behavior
|
||||
bool hasValidPlusPrefix() const;
|
||||
bool hasValidAlternativeForm() const;
|
||||
bool hasValidLeadingZeros() const;
|
||||
bool hasValidSpacePrefix() const;
|
||||
bool hasValidLeftJustified() const;
|
||||
|
||||
bool hasValidLengthModifier() const;
|
||||
bool hasValidPrecision() const;
|
||||
bool hasValidFieldWidth() const;
|
||||
};
|
||||
|
||||
enum PositionContext { FieldWidthPos = 0, PrecisionPos = 1 };
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
namespace clang {
|
||||
|
||||
|
@ -22,13 +22,14 @@
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/DeclCXX.h"
|
||||
|
||||
#define DISPATCH_CASE(CASE,CLASS) \
|
||||
case Decl::CASE: \
|
||||
static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<CLASS*>(D));\
|
||||
#define DISPATCH_CASE(CLASS) \
|
||||
case Decl::CLASS: \
|
||||
static_cast<ImplClass*>(this)->Visit##CLASS##Decl( \
|
||||
static_cast<CLASS##Decl*>(D)); \
|
||||
break;
|
||||
|
||||
#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS(CLASS* D) {}
|
||||
#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS(CLASS* D)\
|
||||
#define DEFAULT_DISPATCH(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D) {}
|
||||
#define DEFAULT_DISPATCH_VARDECL(CLASS) void Visit##CLASS##Decl(CLASS##Decl* D)\
|
||||
{ static_cast<ImplClass*>(this)->VisitVarDecl(D); }
|
||||
|
||||
|
||||
@ -55,34 +56,39 @@ public:
|
||||
|
||||
void VisitDecl(Decl* D) {
|
||||
switch (D->getKind()) {
|
||||
DISPATCH_CASE(Function,FunctionDecl)
|
||||
DISPATCH_CASE(CXXMethod,CXXMethodDecl)
|
||||
DISPATCH_CASE(Var,VarDecl)
|
||||
DISPATCH_CASE(ParmVar,ParmVarDecl) // FIXME: (same)
|
||||
DISPATCH_CASE(ImplicitParam,ImplicitParamDecl)
|
||||
DISPATCH_CASE(EnumConstant,EnumConstantDecl)
|
||||
DISPATCH_CASE(Typedef,TypedefDecl)
|
||||
DISPATCH_CASE(Record,RecordDecl) // FIXME: Refine. VisitStructDecl?
|
||||
DISPATCH_CASE(Enum,EnumDecl)
|
||||
DISPATCH_CASE(Function)
|
||||
DISPATCH_CASE(CXXMethod)
|
||||
DISPATCH_CASE(Var)
|
||||
DISPATCH_CASE(ParmVar) // FIXME: (same)
|
||||
DISPATCH_CASE(ImplicitParam)
|
||||
DISPATCH_CASE(EnumConstant)
|
||||
DISPATCH_CASE(Typedef)
|
||||
DISPATCH_CASE(Record) // FIXME: Refine. VisitStructDecl?
|
||||
DISPATCH_CASE(CXXRecord)
|
||||
DISPATCH_CASE(Enum)
|
||||
default:
|
||||
assert(false && "Subtype of ScopedDecl not handled.");
|
||||
}
|
||||
}
|
||||
|
||||
DEFAULT_DISPATCH(VarDecl)
|
||||
DEFAULT_DISPATCH(FunctionDecl)
|
||||
DEFAULT_DISPATCH(CXXMethodDecl)
|
||||
DEFAULT_DISPATCH_VARDECL(ParmVarDecl)
|
||||
DEFAULT_DISPATCH(ImplicitParamDecl)
|
||||
DEFAULT_DISPATCH(EnumConstantDecl)
|
||||
DEFAULT_DISPATCH(TypedefDecl)
|
||||
DEFAULT_DISPATCH(RecordDecl)
|
||||
DEFAULT_DISPATCH(EnumDecl)
|
||||
DEFAULT_DISPATCH(ObjCInterfaceDecl)
|
||||
DEFAULT_DISPATCH(ObjCClassDecl)
|
||||
DEFAULT_DISPATCH(ObjCMethodDecl)
|
||||
DEFAULT_DISPATCH(ObjCProtocolDecl)
|
||||
DEFAULT_DISPATCH(ObjCCategoryDecl)
|
||||
DEFAULT_DISPATCH(Var)
|
||||
DEFAULT_DISPATCH(Function)
|
||||
DEFAULT_DISPATCH(CXXMethod)
|
||||
DEFAULT_DISPATCH_VARDECL(ParmVar)
|
||||
DEFAULT_DISPATCH(ImplicitParam)
|
||||
DEFAULT_DISPATCH(EnumConstant)
|
||||
DEFAULT_DISPATCH(Typedef)
|
||||
DEFAULT_DISPATCH(Record)
|
||||
DEFAULT_DISPATCH(Enum)
|
||||
DEFAULT_DISPATCH(ObjCInterface)
|
||||
DEFAULT_DISPATCH(ObjCClass)
|
||||
DEFAULT_DISPATCH(ObjCMethod)
|
||||
DEFAULT_DISPATCH(ObjCProtocol)
|
||||
DEFAULT_DISPATCH(ObjCCategory)
|
||||
|
||||
void VisitCXXRecordDecl(CXXRecordDecl *D) {
|
||||
static_cast<ImplClass*>(this)->VisitRecordDecl(D);
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
382
include/clang/Basic/Attr.td
Normal file
382
include/clang/Basic/Attr.td
Normal file
@ -0,0 +1,382 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Note: This file is a work in progress. Please do not apply non-trivial
|
||||
// updates unless you have talked to Sean Hunt <rideau3@gmail.com> prior.
|
||||
// Merely adding a new attribute is a trivial update.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// An attribute's subject is whatever it appertains to. In this file, it is
|
||||
// more accurately a list of things that an attribute can appertain to. All
|
||||
// Decls and Stmts are possibly AttrSubjects (even though the syntax may not
|
||||
// allow attributes on a given Decl or Stmt).
|
||||
class AttrSubject;
|
||||
|
||||
include "clang/Basic/DeclNodes.td"
|
||||
include "clang/Basic/StmtNodes.td"
|
||||
|
||||
// A subset-subject is an AttrSubject constrained to operate only on some subset
|
||||
// of that subject.
|
||||
//
|
||||
// The description is used in output messages to specify what the subject
|
||||
// represents. FIXME: Deal with translation issues.
|
||||
//
|
||||
// The code fragment is a boolean expression that will confirm that the subject
|
||||
// meets the requirements; the subject will have the name S, and will have the
|
||||
// type specified by the base. It should be a simple boolean expression.
|
||||
class SubsetSubject<AttrSubject base, string description, code check>
|
||||
: AttrSubject {
|
||||
AttrSubject Base = base;
|
||||
string Description = description;
|
||||
code CheckCode = check;
|
||||
}
|
||||
|
||||
// This is the type of a variable which C++0x defines [[aligned()]] as being
|
||||
// a possible subject.
|
||||
def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable",
|
||||
[{S->getStorageClass() != VarDecl::Register &&
|
||||
S->getKind() != Decl::ImplicitParam
|
||||
S->getKind() != Decl::ParmVar
|
||||
S->getKind() != Decl::NonTypeTemplateParm}]>;
|
||||
def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function",
|
||||
[{S->isVirtual()}]>;
|
||||
def NonBitField : SubsetSubject<Field, "non-bit field",
|
||||
[{!S->isBitField()}]>;
|
||||
|
||||
// A single argument to an attribute
|
||||
class Argument<string name> {
|
||||
string Name = name;
|
||||
}
|
||||
|
||||
class IdentifierArgument<string name> : Argument<name>;
|
||||
class IntArgument<string name> : Argument<name>;
|
||||
class StringArgument<string name> : Argument<name>;
|
||||
class ExprArgument<string name> : Argument<name>;
|
||||
class FunctionArgument<string name> : Argument<name>;
|
||||
class ObjCInterfaceArgument<string name> : Argument<name>;
|
||||
class UnsignedIntArgument<string name> : Argument<name>;
|
||||
class UnsignedIntOrTypeArgument<string name> : Argument<name>;
|
||||
|
||||
// An integer argument with a default value
|
||||
class DefaultIntArgument<string name, int default> : IntArgument<name> {
|
||||
int Default = default;
|
||||
}
|
||||
|
||||
// Zero or more arguments of a type
|
||||
class VariadicArgument<Argument arg> : Argument<arg.Name> {
|
||||
Argument VariadicArg = arg;
|
||||
}
|
||||
|
||||
class Attr {
|
||||
// The various ways in which an attribute can be spelled in source
|
||||
list<string> Spellings;
|
||||
// The things to which an attribute can appertain
|
||||
list<AttrSubject> Subjects;
|
||||
// The arguments allowed on an attribute
|
||||
list<Argument> Args = [];
|
||||
// The namespaces in which the attribute appears in C++0x attributes.
|
||||
// The attribute will not be permitted in C++0x attribute-specifiers if
|
||||
// this is empty; the empty string can be used as a namespace.
|
||||
list<string> Namespaces = [];
|
||||
// A temporary development bit to tell TableGen not to emit certain
|
||||
// information about the attribute.
|
||||
bit DoNotEmit = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Attributes begin here
|
||||
//
|
||||
|
||||
def Alias : Attr {
|
||||
let Spellings = ["alias"];
|
||||
let Args = [StringArgument<"AliasName">];
|
||||
}
|
||||
|
||||
def Aligned : Attr {
|
||||
let Spellings = ["align", "aligned"];
|
||||
let Subjects = [NonBitField, NormalVar, Tag];
|
||||
let Args = [UnsignedIntOrTypeArgument<"Alignment">];
|
||||
let Namespaces = ["", "std"];
|
||||
}
|
||||
|
||||
def AlignMac68k : Attr {
|
||||
let Spellings = [];
|
||||
}
|
||||
|
||||
def AlwaysInline : Attr {
|
||||
let Spellings = ["always_inline"];
|
||||
}
|
||||
|
||||
def AnalyzerNoReturn : Attr {
|
||||
let Spellings = ["analyzer_noreturn"];
|
||||
}
|
||||
|
||||
def Annotate : Attr {
|
||||
let Spellings = ["annotate"];
|
||||
let Args = [StringArgument<"Annotation">];
|
||||
}
|
||||
|
||||
def AsmLabel : Attr {
|
||||
let Spellings = [];
|
||||
let Args = [StringArgument<"Label">];
|
||||
}
|
||||
|
||||
def BaseCheck : Attr {
|
||||
let Spellings = ["base_check"];
|
||||
let Subjects = [CXXRecord];
|
||||
let Namespaces = ["", "std"];
|
||||
let DoNotEmit = 0;
|
||||
}
|
||||
|
||||
def Blocks : Attr {
|
||||
let Spellings = ["blocks"];
|
||||
let Args = [IdentifierArgument<"Type">];
|
||||
}
|
||||
|
||||
def CarriesDependency : Attr {
|
||||
let Spellings = ["carries_dependency"];
|
||||
let Subjects = [ParmVar, Function];
|
||||
let Namespaces = ["", "std"];
|
||||
let DoNotEmit = 0;
|
||||
}
|
||||
|
||||
def CDecl : Attr {
|
||||
let Spellings = ["cdecl", "__cdecl"];
|
||||
}
|
||||
|
||||
def CFReturnsRetained : Attr {
|
||||
let Spellings = ["cf_returns_retained"];
|
||||
}
|
||||
|
||||
def CFReturnsNotRetained : Attr {
|
||||
let Spellings = ["cf_returns_not_retained"];
|
||||
}
|
||||
|
||||
def Cleanup : Attr {
|
||||
let Spellings = ["cleanup"];
|
||||
let Args = [FunctionArgument<"FunctionDecl">];
|
||||
}
|
||||
|
||||
def Const : Attr {
|
||||
let Spellings = ["const"];
|
||||
}
|
||||
|
||||
def Constructor : Attr {
|
||||
let Spellings = ["constructor"];
|
||||
let Args = [IntArgument<"Priority">];
|
||||
}
|
||||
|
||||
def Deprecated : Attr {
|
||||
let Spellings = ["deprecated"];
|
||||
}
|
||||
|
||||
def Destructor : Attr {
|
||||
let Spellings = ["destructor"];
|
||||
let Args = [IntArgument<"Priority">];
|
||||
}
|
||||
|
||||
def DLLExport : Attr {
|
||||
let Spellings = ["dllexport"];
|
||||
}
|
||||
|
||||
def DLLImport : Attr {
|
||||
let Spellings = ["dllimport"];
|
||||
}
|
||||
|
||||
def FastCall : Attr {
|
||||
let Spellings = ["fastcall", "__fastcall"];
|
||||
}
|
||||
|
||||
def Final : Attr {
|
||||
let Spellings = ["final"];
|
||||
let Subjects = [CXXRecord, CXXVirtualMethod];
|
||||
let Namespaces = ["", "std"];
|
||||
let DoNotEmit = 0;
|
||||
}
|
||||
|
||||
def Format : Attr {
|
||||
let Spellings = ["format"];
|
||||
let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
|
||||
IntArgument<"FirstArg">];
|
||||
}
|
||||
|
||||
def FormatArg : Attr {
|
||||
let Spellings = ["format_arg"];
|
||||
let Args = [IntArgument<"FormatIdx">];
|
||||
}
|
||||
|
||||
def GNUInline : Attr {
|
||||
let Spellings = ["gnu_inline"];
|
||||
}
|
||||
|
||||
def Hiding : Attr {
|
||||
let Spellings = ["hiding"];
|
||||
let Subjects = [Field, CXXMethod];
|
||||
let Namespaces = ["", "std"];
|
||||
let DoNotEmit = 0;
|
||||
}
|
||||
|
||||
def IBAction : Attr {
|
||||
let Spellings = ["ibaction"];
|
||||
}
|
||||
|
||||
def IBOutlet : Attr {
|
||||
let Spellings = ["iboutlet"];
|
||||
}
|
||||
|
||||
def IBOutletCollection : Attr {
|
||||
let Spellings = ["iboutletcollection"];
|
||||
let Args = [ObjCInterfaceArgument<"Class">];
|
||||
}
|
||||
|
||||
def Malloc : Attr {
|
||||
let Spellings = ["malloc"];
|
||||
}
|
||||
|
||||
def MaxFieldAlignment : Attr {
|
||||
let Spellings = [];
|
||||
let Args = [UnsignedIntArgument<"Alignment">];
|
||||
}
|
||||
|
||||
def MSP430Interrupt : Attr {
|
||||
let Spellings = [];
|
||||
let Args = [UnsignedIntArgument<"Number">];
|
||||
}
|
||||
|
||||
def NoDebug : Attr {
|
||||
let Spellings = ["nodebug"];
|
||||
}
|
||||
|
||||
def NoInline : Attr {
|
||||
let Spellings = ["noinline"];
|
||||
}
|
||||
|
||||
def NonNull : Attr {
|
||||
let Spellings = ["nonnull"];
|
||||
let Args = [VariadicArgument<UnsignedIntArgument<"Args">>];
|
||||
}
|
||||
|
||||
def NoReturn : Attr {
|
||||
let Spellings = ["noreturn"];
|
||||
// FIXME: Does GCC allow this on the function instead?
|
||||
let Subjects = [Function];
|
||||
let Namespaces = ["", "std"];
|
||||
}
|
||||
|
||||
def NoInstrumentFunction : Attr {
|
||||
let Spellings = ["no_instrument_function"];
|
||||
let Subjects = [Function];
|
||||
}
|
||||
|
||||
def NoThrow : Attr {
|
||||
let Spellings = ["nothrow"];
|
||||
}
|
||||
|
||||
def NSReturnsRetained : Attr {
|
||||
let Spellings = ["ns_returns_retained"];
|
||||
}
|
||||
|
||||
def NSReturnsNotRetained : Attr {
|
||||
let Spellings = ["ns_returns_not_retained"];
|
||||
}
|
||||
|
||||
def ObjCException : Attr {
|
||||
let Spellings = ["objc_exception"];
|
||||
}
|
||||
|
||||
def ObjCNSObject : Attr {
|
||||
let Spellings = ["NSOjbect"];
|
||||
}
|
||||
|
||||
def Override : Attr {
|
||||
let Spellings = ["override"];
|
||||
let Subjects = [CXXVirtualMethod];
|
||||
let Namespaces = ["", "std"];
|
||||
let DoNotEmit = 0;
|
||||
}
|
||||
|
||||
def Overloadable : Attr {
|
||||
let Spellings = ["overloadable"];
|
||||
}
|
||||
|
||||
def Packed : Attr {
|
||||
let Spellings = ["packed"];
|
||||
}
|
||||
|
||||
def Pure : Attr {
|
||||
let Spellings = ["pure"];
|
||||
}
|
||||
|
||||
def Regparm : Attr {
|
||||
let Spellings = ["regparm"];
|
||||
let Args = [UnsignedIntArgument<"NumParams">];
|
||||
}
|
||||
|
||||
def ReqdWorkGroupSize : Attr {
|
||||
let Spellings = ["reqd_work_group_size"];
|
||||
let Args = [UnsignedIntArgument<"XDim">, UnsignedIntArgument<"YDim">,
|
||||
UnsignedIntArgument<"ZDim">];
|
||||
}
|
||||
|
||||
def InitPriority : Attr {
|
||||
let Spellings = ["init_priority"];
|
||||
let Args = [UnsignedIntArgument<"Priority">];
|
||||
}
|
||||
|
||||
def Section : Attr {
|
||||
let Spellings = ["section"];
|
||||
let Args = [StringArgument<"Name">];
|
||||
}
|
||||
|
||||
def Sentinel : Attr {
|
||||
let Spellings = ["sentinel"];
|
||||
let Args = [DefaultIntArgument<"NulPos", 0>,
|
||||
DefaultIntArgument<"Sentinel", 0>];
|
||||
}
|
||||
|
||||
def StdCall : Attr {
|
||||
let Spellings = ["stdcall", "__stdcall"];
|
||||
}
|
||||
|
||||
def ThisCall : Attr {
|
||||
let Spellings = ["thiscall", "__thiscall"];
|
||||
}
|
||||
|
||||
def TransparentUnion : Attr {
|
||||
let Spellings = ["transparent_union"];
|
||||
}
|
||||
|
||||
def Unavailable : Attr {
|
||||
let Spellings = ["unavailable"];
|
||||
}
|
||||
|
||||
def Unused : Attr {
|
||||
let Spellings = ["unused"];
|
||||
}
|
||||
|
||||
def Used : Attr {
|
||||
let Spellings = ["used"];
|
||||
}
|
||||
|
||||
def Visibility : Attr {
|
||||
let Spellings = ["visibility"];
|
||||
let Args = [StringArgument<"Visibility">];
|
||||
}
|
||||
|
||||
def WarnUnusedResult : Attr {
|
||||
let Spellings = ["warn_unused_result"];
|
||||
}
|
||||
|
||||
def Weak : Attr {
|
||||
let Spellings = ["weak"];
|
||||
}
|
||||
|
||||
def WeakImport : Attr {
|
||||
let Spellings = ["weak_import"];
|
||||
}
|
||||
|
||||
def WeakRef : Attr {
|
||||
let Spellings = ["weakref"];
|
||||
}
|
||||
|
||||
def X86ForceAlignArgPointer : Attr {
|
||||
let Spellings = [];
|
||||
}
|
31
include/clang/Basic/AttrKinds.h
Normal file
31
include/clang/Basic/AttrKinds.h
Normal file
@ -0,0 +1,31 @@
|
||||
//===----- Attr.h - Enum values for C Attribute Kinds ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the attr::Kind enum
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_ATTRKINDS_H
|
||||
#define LLVM_CLANG_ATTRKINDS_H
|
||||
|
||||
namespace clang {
|
||||
|
||||
namespace attr {
|
||||
|
||||
// Kind - This is a list of all the recognized kinds of attributes.
|
||||
enum Kind {
|
||||
#define ATTR(X) X,
|
||||
#include "clang/Basic/AttrList.inc"
|
||||
NUM_ATTRS
|
||||
};
|
||||
|
||||
} // end namespace attr
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
@ -540,6 +540,7 @@ LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h")
|
||||
// id objc_msgSend(id, SEL)
|
||||
// but we need new type letters for that.
|
||||
LIBBUILTIN(objc_msgSend, "v*.", "f", "objc/message.h")
|
||||
BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
|
||||
|
||||
// Builtin math library functions
|
||||
LIBBUILTIN(pow, "ddd", "fe", "math.h")
|
||||
|
@ -14,7 +14,13 @@
|
||||
|
||||
// The format of this database matches clang/Basic/Builtins.def.
|
||||
|
||||
// FIXME: This is just a placeholder. NEON intrinsics should be listed here.
|
||||
// In libgcc
|
||||
BUILTIN(__clear_cache, "vc*c*", "")
|
||||
BUILTIN(__builtin_thread_pointer, "v*", "")
|
||||
|
||||
// NEON
|
||||
#define GET_NEON_BUILTINS
|
||||
#include "clang/Basic/arm_neon.inc"
|
||||
#undef GET_NEON_BUILTINS
|
||||
|
||||
#undef BUILTIN
|
||||
|
@ -18,14 +18,6 @@
|
||||
// The format of this database matches clang/Basic/Builtins.def.
|
||||
|
||||
// This is just a placeholder, the types and attributes are wrong.
|
||||
BUILTIN(__builtin_altivec_abs_v16qi, "V16UcV16Sc", "")
|
||||
BUILTIN(__builtin_altivec_abs_v8hi, "V8UsV8Ss", "")
|
||||
BUILTIN(__builtin_altivec_abs_v4si, "V4UiV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_abss_v16qi, "V16UcV16Sc", "")
|
||||
BUILTIN(__builtin_altivec_abss_v8hi, "V8UsV8Ss", "")
|
||||
BUILTIN(__builtin_altivec_abss_v4si, "V4UiV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vaddcuw, "V4UiV4UiV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vaddsbs, "V16ScV16ScV16Sc", "")
|
||||
@ -49,6 +41,67 @@ BUILTIN(__builtin_altivec_vavguh, "V8UsV8UsV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vavgsw, "V4SiV4SiV4Si", "")
|
||||
BUILTIN(__builtin_altivec_vavguw, "V4UiV4UiV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrfip, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vcfsx, "V4fV4ii", "")
|
||||
BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "")
|
||||
BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "")
|
||||
BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_dss, "vUi", "")
|
||||
BUILTIN(__builtin_altivec_dssall, "v", "")
|
||||
BUILTIN(__builtin_altivec_dst, "vv*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dstt, "vv*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dstst, "vv*iUi", "")
|
||||
BUILTIN(__builtin_altivec_dststt, "vv*iUi", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vexptefp, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrfim, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_lvx, "V4iiv*", "")
|
||||
BUILTIN(__builtin_altivec_lvxl, "V4iiv*", "")
|
||||
BUILTIN(__builtin_altivec_lvebx, "V16civ*", "")
|
||||
BUILTIN(__builtin_altivec_lvehx, "V8siv*", "")
|
||||
BUILTIN(__builtin_altivec_lvewx, "V4iiv*", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vlogefp, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_lvsl, "V16cUcv*", "")
|
||||
BUILTIN(__builtin_altivec_lvsr, "V16cUcv*", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vmaddfp, "V4fV4fV4fV4f", "")
|
||||
BUILTIN(__builtin_altivec_vmhaddshs, "V8sV8sV8sV8s", "")
|
||||
BUILTIN(__builtin_altivec_vmhraddshs, "V8sV8sV8sV8s", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vmsumubm, "V4UiV16UcV16UcV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vmsummbm, "V4SiV16ScV16UcV4Si", "")
|
||||
BUILTIN(__builtin_altivec_vmsumuhm, "V4UiV8UsV8UsV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vmsumshm, "V4SiV8SsV8SsV4Si", "")
|
||||
BUILTIN(__builtin_altivec_vmsumuhs, "V4UiV8UsV8UsV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vmsumshs, "V4SiV8SsV8SsV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vmuleub, "V8UsV16UcV16Uc", "")
|
||||
BUILTIN(__builtin_altivec_vmulesb, "V8SsV16ScV16Sc", "")
|
||||
BUILTIN(__builtin_altivec_vmuleuh, "V4UiV8UsV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vmulesh, "V4SiV8SsV8Ss", "")
|
||||
BUILTIN(__builtin_altivec_vmuloub, "V8UsV16UcV16Uc", "")
|
||||
BUILTIN(__builtin_altivec_vmulosb, "V8SsV16ScV16Sc", "")
|
||||
BUILTIN(__builtin_altivec_vmulouh, "V4UiV8UsV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vmulosh, "V4SiV8SsV8Ss", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vnmsubfp, "V4fV4fV4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vpkpx, "V8sV4UiV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vpkuhus, "V16UcV8UsV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vpkshss, "V16ScV8SsV8Ss", "")
|
||||
BUILTIN(__builtin_altivec_vpkuwus, "V8UsV4UiV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vpkswss, "V8SsV4SiV4Si", "")
|
||||
BUILTIN(__builtin_altivec_vpkshus, "V16UcV8SsV8Ss", "")
|
||||
BUILTIN(__builtin_altivec_vpkswus, "V8UsV4SiV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vperm_4si, "V4iV4iV4iV16Uc", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_stvx, "vV4iiv*", "")
|
||||
BUILTIN(__builtin_altivec_stvxl, "vV4iiv*", "")
|
||||
BUILTIN(__builtin_altivec_stvebx, "vV16civ*", "")
|
||||
@ -92,6 +145,48 @@ BUILTIN(__builtin_altivec_vminfp, "V4fV4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_mtvscr, "vV4i", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrefp, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrlb, "V16cV16cV16Uc", "")
|
||||
BUILTIN(__builtin_altivec_vrlh, "V8sV8sV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vrlw, "V4iV4iV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsel_4si, "V4iV4iV4iV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsl, "V4iV4iV4i", "")
|
||||
BUILTIN(__builtin_altivec_vslo, "V4iV4iV4i", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsrab, "V16cV16cV16Uc", "")
|
||||
BUILTIN(__builtin_altivec_vsrah, "V8sV8sV8Us", "")
|
||||
BUILTIN(__builtin_altivec_vsraw, "V4iV4iV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsr, "V4iV4iV4i", "")
|
||||
BUILTIN(__builtin_altivec_vsro, "V4iV4iV4i", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrfin, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrsqrtefp, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsubcuw, "V4UiV4UiV4Ui", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsum4sbs, "V4SiV16ScV4Si", "")
|
||||
BUILTIN(__builtin_altivec_vsum4ubs, "V4UiV16UcV4Ui", "")
|
||||
BUILTIN(__builtin_altivec_vsum4shs, "V4SiV8SsV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsum2sws, "V4SiV4SiV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vsumsws, "V4SiV4SiV4Si", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vrfiz, "V4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vupkhsb, "V8sV16c", "")
|
||||
BUILTIN(__builtin_altivec_vupkhpx, "V4UiV8s", "")
|
||||
BUILTIN(__builtin_altivec_vupkhsh, "V4iV8s", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vupklsb, "V8sV16c", "")
|
||||
BUILTIN(__builtin_altivec_vupklpx, "V4UiV8s", "")
|
||||
BUILTIN(__builtin_altivec_vupklsh, "V4iV8s", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vcmpbfp_p, "iiV4fV4f", "")
|
||||
|
||||
BUILTIN(__builtin_altivec_vcmpgefp_p, "iiV4fV4f", "")
|
||||
|
@ -18,3 +18,15 @@ tablegen(DiagnosticGroups.inc
|
||||
-gen-clang-diag-groups)
|
||||
add_custom_target(ClangDiagnosticGroups
|
||||
DEPENDS DiagnosticGroups.inc)
|
||||
|
||||
set(LLVM_TARGET_DEFINITIONS Attr.td)
|
||||
tablegen(AttrList.inc
|
||||
-gen-clang-attr-list
|
||||
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../)
|
||||
add_custom_target(ClangAttrList
|
||||
DEPENDS AttrList.inc)
|
||||
|
||||
# ARM NEON
|
||||
set(LLVM_TARGET_DEFINITIONS arm_neon.td)
|
||||
tablegen(arm_neon.inc -gen-arm-neon-sema)
|
||||
add_custom_target(ClangARMNeon DEPENDS arm_neon.inc)
|
||||
|
70
include/clang/Basic/DeclNodes.td
Normal file
70
include/clang/Basic/DeclNodes.td
Normal file
@ -0,0 +1,70 @@
|
||||
class AttrSubject;
|
||||
|
||||
class Decl<bit abstract = 0> : AttrSubject {
|
||||
bit Abstract = abstract;
|
||||
}
|
||||
|
||||
class DDecl<Decl base, bit abstract = 0> : Decl<abstract> {
|
||||
Decl Base = base;
|
||||
}
|
||||
|
||||
class DeclContext { }
|
||||
|
||||
def TranslationUnit : Decl, DeclContext;
|
||||
def Named : Decl<1>;
|
||||
def Namespace : DDecl<Named>, DeclContext;
|
||||
def UsingDirective : DDecl<Named>;
|
||||
def NamespaceAlias : DDecl<Named>;
|
||||
def Type : DDecl<Named, 1>;
|
||||
def Typedef : DDecl<Type>;
|
||||
def UnresolvedUsingTypename : DDecl<Type>;
|
||||
def Tag : DDecl<Type, 1>, DeclContext;
|
||||
def Enum : DDecl<Tag>;
|
||||
def Record : DDecl<Tag>;
|
||||
def CXXRecord : DDecl<Record>;
|
||||
def ClassTemplateSpecialization : DDecl<CXXRecord>;
|
||||
def ClassTemplatePartialSpecialization
|
||||
: DDecl<ClassTemplateSpecialization>;
|
||||
def TemplateTypeParm : DDecl<Type>;
|
||||
def Value : DDecl<Named, 1>;
|
||||
def EnumConstant : DDecl<Value>;
|
||||
def UnresolvedUsingValue : DDecl<Value>;
|
||||
def Declarator : DDecl<Value, 1>;
|
||||
def Function : DDecl<Declarator>, DeclContext;
|
||||
def CXXMethod : DDecl<Function>;
|
||||
def CXXConstructor : DDecl<CXXMethod>;
|
||||
def CXXDestructor : DDecl<CXXMethod>;
|
||||
def CXXConversion : DDecl<CXXMethod>;
|
||||
def Field : DDecl<Declarator>;
|
||||
def ObjCIvar : DDecl<Field>;
|
||||
def ObjCAtDefsField : DDecl<Field>;
|
||||
def Var : DDecl<Declarator>;
|
||||
def ImplicitParam : DDecl<Var>;
|
||||
def ParmVar : DDecl<Var>;
|
||||
def NonTypeTemplateParm : DDecl<Var>;
|
||||
def Template : DDecl<Named, 1>;
|
||||
def FunctionTemplate : DDecl<Template>;
|
||||
def ClassTemplate : DDecl<Template>;
|
||||
def TemplateTemplateParm : DDecl<Template>;
|
||||
def Using : DDecl<Named>;
|
||||
def UsingShadow : DDecl<Named>;
|
||||
def ObjCMethod : DDecl<Named>, DeclContext;
|
||||
def ObjCContainer : DDecl<Named, 1>, DeclContext;
|
||||
def ObjCCategory : DDecl<ObjCContainer>;
|
||||
def ObjCProtocol : DDecl<ObjCContainer>;
|
||||
def ObjCInterface : DDecl<ObjCContainer>;
|
||||
def ObjCImpl : DDecl<ObjCContainer, 1>;
|
||||
def ObjCCategoryImpl : DDecl<ObjCImpl>;
|
||||
def ObjCImplementation : DDecl<ObjCImpl>;
|
||||
def ObjCProperty : DDecl<Named>;
|
||||
def ObjCCompatibleAlias : DDecl<Named>;
|
||||
def LinkageSpec : Decl, DeclContext;
|
||||
def ObjCPropertyImpl : Decl;
|
||||
def ObjCForwardProtocol : Decl;
|
||||
def ObjCClass : Decl;
|
||||
def FileScopeAsm : Decl;
|
||||
def AccessSpec : Decl;
|
||||
def Friend : Decl;
|
||||
def FriendTemplate : Decl;
|
||||
def StaticAssert : Decl;
|
||||
def Block : Decl, DeclContext;
|
@ -24,7 +24,6 @@
|
||||
|
||||
namespace llvm {
|
||||
template <typename T> class SmallVectorImpl;
|
||||
class raw_ostream;
|
||||
}
|
||||
|
||||
namespace clang {
|
||||
@ -36,8 +35,6 @@ namespace clang {
|
||||
class LangOptions;
|
||||
class PartialDiagnostic;
|
||||
class Preprocessor;
|
||||
class SourceManager;
|
||||
class SourceRange;
|
||||
|
||||
// Import the diagnostic enums themselves.
|
||||
namespace diag {
|
||||
@ -98,8 +95,8 @@ namespace clang {
|
||||
/// compilation.
|
||||
class FixItHint {
|
||||
public:
|
||||
/// \brief Tokens that should be removed to correct the error.
|
||||
SourceRange RemoveRange;
|
||||
/// \brief Code that should be removed to correct the error.
|
||||
CharSourceRange RemoveRange;
|
||||
|
||||
/// \brief The location at which we should insert code to correct
|
||||
/// the error.
|
||||
@ -129,15 +126,18 @@ public:
|
||||
|
||||
/// \brief Create a code modification hint that removes the given
|
||||
/// source range.
|
||||
static FixItHint CreateRemoval(SourceRange RemoveRange) {
|
||||
static FixItHint CreateRemoval(CharSourceRange RemoveRange) {
|
||||
FixItHint Hint;
|
||||
Hint.RemoveRange = RemoveRange;
|
||||
return Hint;
|
||||
}
|
||||
|
||||
static FixItHint CreateRemoval(SourceRange RemoveRange) {
|
||||
return CreateRemoval(CharSourceRange::getTokenRange(RemoveRange));
|
||||
}
|
||||
|
||||
/// \brief Create a code modification hint that replaces the given
|
||||
/// source range with the given code string.
|
||||
static FixItHint CreateReplacement(SourceRange RemoveRange,
|
||||
static FixItHint CreateReplacement(CharSourceRange RemoveRange,
|
||||
llvm::StringRef Code) {
|
||||
FixItHint Hint;
|
||||
Hint.RemoveRange = RemoveRange;
|
||||
@ -145,6 +145,11 @@ public:
|
||||
Hint.CodeToInsert = Code;
|
||||
return Hint;
|
||||
}
|
||||
|
||||
static FixItHint CreateReplacement(SourceRange RemoveRange,
|
||||
llvm::StringRef Code) {
|
||||
return CreateReplacement(CharSourceRange::getTokenRange(RemoveRange), Code);
|
||||
}
|
||||
};
|
||||
|
||||
/// Diagnostic - This concrete class is used by the front-end to report
|
||||
@ -176,7 +181,14 @@ public:
|
||||
ak_nestednamespec, // NestedNameSpecifier *
|
||||
ak_declcontext // DeclContext *
|
||||
};
|
||||
|
||||
|
||||
/// Specifies which overload candidates to display when overload resolution
|
||||
/// fails.
|
||||
enum OverloadsShown {
|
||||
Ovl_All, ///< Show all overloads.
|
||||
Ovl_Best ///< Show just the "best" overload candidates.
|
||||
};
|
||||
|
||||
/// ArgumentValue - This typedef represents on argument value, which is a
|
||||
/// union discriminated by ArgumentKind, with a value.
|
||||
typedef std::pair<ArgumentKind, intptr_t> ArgumentValue;
|
||||
@ -188,6 +200,7 @@ private:
|
||||
bool ErrorsAsFatal; // Treat errors like fatal errors.
|
||||
bool SuppressSystemWarnings; // Suppress warnings in system headers.
|
||||
bool SuppressAllDiagnostics; // Suppress all diagnostics.
|
||||
OverloadsShown ShowOverloads; // Which overload candidates to show.
|
||||
unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit.
|
||||
unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack,
|
||||
// 0 -> no limit.
|
||||
@ -318,6 +331,13 @@ public:
|
||||
}
|
||||
bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; }
|
||||
|
||||
/// \brief Specify which overload candidates to show when overload resolution
|
||||
/// fails. By default, we show all candidates.
|
||||
void setShowOverloads(OverloadsShown Val) {
|
||||
ShowOverloads = Val;
|
||||
}
|
||||
OverloadsShown getShowOverloads() const { return ShowOverloads; }
|
||||
|
||||
/// \brief Pretend that the last diagnostic issued was ignored. This can
|
||||
/// be used by clients who suppress diagnostics themselves.
|
||||
void setLastDiagnosticIgnored() {
|
||||
@ -582,7 +602,7 @@ private:
|
||||
|
||||
/// DiagRanges - The list of ranges added to this diagnostic. It currently
|
||||
/// only support 10 ranges, could easily be extended if needed.
|
||||
SourceRange DiagRanges[10];
|
||||
CharSourceRange DiagRanges[10];
|
||||
|
||||
enum { MaxFixItHints = 3 };
|
||||
|
||||
@ -681,7 +701,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void AddSourceRange(const SourceRange &R) const {
|
||||
void AddSourceRange(const CharSourceRange &R) const {
|
||||
assert(NumRanges <
|
||||
sizeof(DiagObj->DiagRanges)/sizeof(DiagObj->DiagRanges[0]) &&
|
||||
"Too many arguments to diagnostic!");
|
||||
@ -752,10 +772,16 @@ operator<<(const DiagnosticBuilder &DB, T *DC) {
|
||||
|
||||
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
const SourceRange &R) {
|
||||
DB.AddSourceRange(R);
|
||||
DB.AddSourceRange(CharSourceRange::getTokenRange(R));
|
||||
return DB;
|
||||
}
|
||||
|
||||
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
const CharSourceRange &R) {
|
||||
DB.AddSourceRange(R);
|
||||
return DB;
|
||||
}
|
||||
|
||||
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
|
||||
const FixItHint &Hint) {
|
||||
DB.AddFixItHint(Hint);
|
||||
@ -849,7 +875,7 @@ public:
|
||||
return DiagObj->NumDiagRanges;
|
||||
}
|
||||
|
||||
SourceRange getRange(unsigned Idx) const {
|
||||
const CharSourceRange &getRange(unsigned Idx) const {
|
||||
assert(Idx < DiagObj->NumDiagRanges && "Invalid diagnostic range index!");
|
||||
return DiagObj->DiagRanges[Idx];
|
||||
}
|
||||
@ -886,7 +912,7 @@ class StoredDiagnostic {
|
||||
Diagnostic::Level Level;
|
||||
FullSourceLoc Loc;
|
||||
std::string Message;
|
||||
std::vector<SourceRange> Ranges;
|
||||
std::vector<CharSourceRange> Ranges;
|
||||
std::vector<FixItHint> FixIts;
|
||||
|
||||
public:
|
||||
@ -902,7 +928,7 @@ public:
|
||||
const FullSourceLoc &getLocation() const { return Loc; }
|
||||
llvm::StringRef getMessage() const { return Message; }
|
||||
|
||||
typedef std::vector<SourceRange>::const_iterator range_iterator;
|
||||
typedef std::vector<CharSourceRange>::const_iterator range_iterator;
|
||||
range_iterator range_begin() const { return Ranges.begin(); }
|
||||
range_iterator range_end() const { return Ranges.end(); }
|
||||
unsigned range_size() const { return Ranges.size(); }
|
||||
|
@ -66,6 +66,7 @@ def err_target_unknown_triple : Error<
|
||||
"unknown target triple '%0', please use -triple or -arch">;
|
||||
def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
|
||||
def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
|
||||
def err_target_unknown_cxxabi : Error<"unknown C++ ABI '%0'">;
|
||||
def err_target_invalid_feature : Error<"invalid target feature '%0'">;
|
||||
|
||||
// Source manager
|
||||
|
@ -18,7 +18,10 @@ def err_fe_invalid_ast_action : Error<"invalid action for AST input">,
|
||||
DefaultFatal;
|
||||
// Error generated by the backend.
|
||||
def err_fe_inline_asm : Error<"%0">, CatInlineAsm;
|
||||
def note_fe_inline_asm_here : Note<"generated from here">;
|
||||
def note_fe_inline_asm_here : Note<"instantated into assembly here">;
|
||||
|
||||
|
||||
|
||||
def err_fe_invalid_code_complete_file : Error<
|
||||
"cannot locate code-completion file %0">, DefaultFatal;
|
||||
def err_fe_stdout_binary : Error<"unable to change standard output to binary">,
|
||||
@ -186,9 +189,6 @@ def warn_pch_math_errno : Error<
|
||||
"math functions %select{do not respect|respect}0 'errno' in PCH "
|
||||
"file but they are currently set to %select{not respect|respect}1 "
|
||||
"'errno'">;
|
||||
def warn_pch_overflow_checking : Error<
|
||||
"signed integer overflow checking was %select{disabled|enabled}0 in PCH "
|
||||
"file but is currently %select{disabled|enabled}1">;
|
||||
def warn_pch_optimize : Error<
|
||||
"the macro '__OPTIMIZE__' was %select{not defined|defined}0 in "
|
||||
"the PCH file but is currently %select{undefined|defined}1">;
|
||||
|
@ -17,11 +17,14 @@ def Implicit : DiagGroup<"implicit", [
|
||||
]>;
|
||||
|
||||
// Empty DiagGroups are recognized by clang but ignored.
|
||||
def : DiagGroup<"abi">;
|
||||
def : DiagGroup<"address">;
|
||||
def AddressOfTemporary : DiagGroup<"address-of-temporary">;
|
||||
def : DiagGroup<"aggregate-return">;
|
||||
def AmbigMemberTemplate : DiagGroup<"ambiguous-member-template">;
|
||||
def : DiagGroup<"attributes">;
|
||||
def : DiagGroup<"bad-function-cast">;
|
||||
def BoolConversions : DiagGroup<"bool-conversions">;
|
||||
def : DiagGroup<"c++-compat">;
|
||||
def : DiagGroup<"cast-align">;
|
||||
def : DiagGroup<"cast-qual">;
|
||||
@ -51,6 +54,7 @@ def : DiagGroup<"inline">;
|
||||
def : DiagGroup<"int-to-pointer-cast">;
|
||||
def : DiagGroup<"invalid-pch">;
|
||||
def LiteralRange : DiagGroup<"literal-range">;
|
||||
def : DiagGroup<"main">;
|
||||
def MissingBraces : DiagGroup<"missing-braces">;
|
||||
def : DiagGroup<"missing-declarations">;
|
||||
def : DiagGroup<"missing-format-attribute">;
|
||||
@ -62,6 +66,7 @@ def : DiagGroup<"newline-eof">;
|
||||
def LongLong : DiagGroup<"long-long">;
|
||||
def MismatchedTags : DiagGroup<"mismatched-tags">;
|
||||
def MissingFieldInitializers : DiagGroup<"missing-field-initializers">;
|
||||
def InitializerOverrides : DiagGroup<"initializer-overrides">;
|
||||
def NonNull : DiagGroup<"nonnull">;
|
||||
def : DiagGroup<"nonportable-cfstrings">;
|
||||
def : DiagGroup<"non-virtual-dtor">;
|
||||
@ -70,13 +75,17 @@ def : DiagGroup<"overflow">;
|
||||
def : DiagGroup<"overloaded-virtual">;
|
||||
def : DiagGroup<"packed">;
|
||||
def PointerArith : DiagGroup<"pointer-arith">;
|
||||
def PoundWarning : DiagGroup<"#warnings">,
|
||||
DiagCategory<"#warning Directive">;
|
||||
def : DiagGroup<"pointer-to-int-cast">;
|
||||
def : DiagGroup<"redundant-decls">;
|
||||
def ReturnType : DiagGroup<"return-type">;
|
||||
def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy">;
|
||||
def SemiBeforeMethodBody : DiagGroup<"semicolon-before-method-body">;
|
||||
def : DiagGroup<"sequence-point">;
|
||||
def Shadow : DiagGroup<"shadow">;
|
||||
def : DiagGroup<"shorten-64-to-32">;
|
||||
def : DiagGroup<"sign-promo">;
|
||||
def SignCompare : DiagGroup<"sign-compare">;
|
||||
def : DiagGroup<"synth">;
|
||||
|
||||
@ -108,6 +117,7 @@ def Trigraphs : DiagGroup<"trigraphs">;
|
||||
def : DiagGroup<"type-limits">;
|
||||
def Uninitialized : DiagGroup<"uninitialized">;
|
||||
def UnknownPragmas : DiagGroup<"unknown-pragmas">;
|
||||
def UnknownAttributes : DiagGroup<"unknown-attributes">;
|
||||
def UnusedArgument : DiagGroup<"unused-argument">;
|
||||
def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">;
|
||||
def UnusedFunction : DiagGroup<"unused-function">;
|
||||
@ -137,7 +147,7 @@ def Parentheses : DiagGroup<"parentheses", [DiagGroup<"idiomatic-parentheses">]>
|
||||
// -Wconversion has its own warnings, but we split this one out for
|
||||
// legacy reasons.
|
||||
def Conversion : DiagGroup<"conversion",
|
||||
[DiagGroup<"shorten-64-to-32">]>,
|
||||
[DiagGroup<"shorten-64-to-32">, BoolConversions]>,
|
||||
DiagCategory<"Value Conversion Issue">;
|
||||
|
||||
def Unused : DiagGroup<"unused",
|
||||
@ -157,6 +167,7 @@ def Format2 : DiagGroup<"format=2",
|
||||
|
||||
def Extra : DiagGroup<"extra", [
|
||||
MissingFieldInitializers,
|
||||
InitializerOverrides,
|
||||
SemiBeforeMethodBody,
|
||||
SignCompare,
|
||||
UnusedParameter
|
||||
|
@ -106,7 +106,7 @@ def err_invalid_pth_file : Error<
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Preprocessor Diagnostics
|
||||
//===----------------------------------------------------------------------===//
|
||||
def pp_hash_warning : Warning<"#warning%0">, InGroup<DiagGroup<"#warnings">>;
|
||||
def pp_hash_warning : Warning<"#warning%0">, InGroup<PoundWarning>;
|
||||
def pp_include_next_in_primary : Warning<
|
||||
"#include_next in primary source file">;
|
||||
def pp_include_macros_out_of_predefines : Error<
|
||||
@ -225,6 +225,9 @@ def err__Pragma_malformed : Error<
|
||||
"_Pragma takes a parenthesized string literal">;
|
||||
def err_pragma_comment_malformed : Error<
|
||||
"pragma comment requires parenthesized identifier and optional string">;
|
||||
def err_pragma_message_malformed : Error<
|
||||
"pragma message requires parenthesized string">;
|
||||
def warn_pragma_message : Warning<"%0">;
|
||||
def warn_pragma_ignored : Warning<"unknown pragma ignored">,
|
||||
InGroup<UnknownPragmas>, DefaultIgnore;
|
||||
def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
|
||||
|
@ -24,7 +24,9 @@ def ext_empty_source_file : Extension<"ISO C forbids an empty source file">;
|
||||
def ext_top_level_semi : Extension<
|
||||
"extra ';' outside of a function">;
|
||||
def ext_extra_struct_semi : Extension<
|
||||
"extra ';' inside a struct or union">;
|
||||
"extra ';' inside a %0">;
|
||||
def ext_extra_ivar_semi : Extension<
|
||||
"extra ';' inside instance variable list">;
|
||||
|
||||
def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">;
|
||||
def ext_plain_complex : ExtWarn<
|
||||
@ -35,6 +37,7 @@ def ext_thread_before : Extension<"'__thread' before 'static'">;
|
||||
|
||||
def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">;
|
||||
|
||||
def error_empty_enum : Error<"use of empty enum">;
|
||||
def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
|
||||
def err_invalid_short_spec : Error<"'short %0' is invalid">;
|
||||
def err_invalid_long_spec : Error<"'long %0' is invalid">;
|
||||
@ -103,7 +106,7 @@ def err_expected_fn_body : Error<
|
||||
"expected function body after function declarator">;
|
||||
def err_expected_method_body : Error<"expected method body">;
|
||||
def err_invalid_token_after_toplevel_declarator : Error<
|
||||
"invalid token after top level declarator">;
|
||||
"expected ';' after top level declarator">;
|
||||
def err_expected_statement : Error<"expected statement">;
|
||||
def err_expected_lparen_after : Error<"expected '(' after '%0'">;
|
||||
def err_expected_lparen_after_id : Error<"expected '(' after %0">;
|
||||
@ -168,11 +171,15 @@ def err_typename_invalid_functionspec : Error<
|
||||
def err_invalid_decl_spec_combination : Error<
|
||||
"cannot combine with previous '%0' declaration specifier">;
|
||||
def err_invalid_vector_decl_spec_combination : Error<
|
||||
"cannot combine with previous '%0' declaration specifier. '__vector' must be first">;
|
||||
"cannot combine with previous '%0' declaration specifier. "
|
||||
"'__vector' must be first">;
|
||||
def err_invalid_pixel_decl_spec_combination : Error<
|
||||
"'__pixel' must be preceded by '__vector'. '%0' declaration specifier not allowed here">;
|
||||
def err_invalid_vector_double_decl_spec_combination : Error<
|
||||
"cannot use 'double' with '__vector'">;
|
||||
"'__pixel' must be preceded by '__vector'. "
|
||||
"'%0' declaration specifier not allowed here">;
|
||||
def err_invalid_vector_decl_spec : Error<
|
||||
"cannot use '%0' with '__vector'">;
|
||||
def err_invalid_vector_bool_decl_spec : Error<
|
||||
"cannot use '%0' with '__vector bool'">;
|
||||
def warn_vector_long_decl_spec_combination : Warning<
|
||||
"Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
|
||||
def err_friend_invalid_in_context : Error<
|
||||
|
@ -21,12 +21,6 @@ def ext_expr_not_ice : Extension<
|
||||
"expression is not integer constant expression "
|
||||
"(but is allowed as an extension)">;
|
||||
|
||||
def ext_null_pointer_expr_not_ice : Extension<
|
||||
"null pointer expression is not an integer constant expression "
|
||||
"(but is allowed as an extension)">;
|
||||
|
||||
|
||||
|
||||
// Semantic analysis of constant literals.
|
||||
def ext_predef_outside_function : Warning<
|
||||
"predefined identifier is only valid inside function">;
|
||||
@ -80,9 +74,10 @@ def err_designator_for_scalar_init : Error<
|
||||
"designator in initializer for scalar type %0">;
|
||||
def warn_subobject_initializer_overrides : Warning<
|
||||
"subobject initialization overrides initialization of other fields "
|
||||
"within its enclosing subobject">;
|
||||
"within its enclosing subobject">, InGroup<InitializerOverrides>;
|
||||
def warn_initializer_overrides : Warning<
|
||||
"initializer overrides prior initialization of this subobject">;
|
||||
"initializer overrides prior initialization of this subobject">,
|
||||
InGroup<InitializerOverrides>;
|
||||
def note_previous_initializer : Note<
|
||||
"previous initialization %select{|with side effects }0is here"
|
||||
"%select{| (side effects may not occur at run time)}0">;
|
||||
@ -125,6 +120,8 @@ def warn_use_out_of_scope_declaration : Warning<
|
||||
"use of out-of-scope declaration of %0">;
|
||||
def err_inline_non_function : Error<
|
||||
"'inline' can only appear on functions">;
|
||||
def warn_qual_return_type : Warning<
|
||||
"'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">;
|
||||
|
||||
def warn_decl_shadow :
|
||||
Warning<"declaration shadows a %select{"
|
||||
@ -230,6 +227,7 @@ def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
|
||||
|
||||
/// parser diagnostics
|
||||
def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">;
|
||||
def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
|
||||
def err_statically_allocated_object : Error<
|
||||
"interface type cannot be statically allocated">;
|
||||
def err_object_cannot_be_passed_returned_by_value : Error<
|
||||
@ -458,6 +456,9 @@ def warn_weak_vtable : Warning<
|
||||
"emitted in every translation unit">,
|
||||
InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
|
||||
|
||||
def ext_using_undefined_std : ExtWarn<
|
||||
"using directive refers to implicitly-defined namespace 'std'">;
|
||||
|
||||
// C++ exception specifications
|
||||
def err_exception_spec_in_typedef : Error<
|
||||
"exception specifications are not allowed in typedefs">;
|
||||
@ -486,6 +487,10 @@ def err_access : Error<
|
||||
"%1 is a %select{private|protected}0 member of %3">, NoSFINAE;
|
||||
def err_access_ctor : Error<
|
||||
"calling a %select{private|protected}0 constructor of class %2">, NoSFINAE;
|
||||
def ext_rvalue_to_reference_access_ctor : ExtWarn<
|
||||
"C++98 requires an accessible copy constructor for class %2 when binding "
|
||||
"a reference to a temporary; was %select{private|protected}0">,
|
||||
NoSFINAE, InGroup<BindToTemporaryCopy>;
|
||||
def err_access_base : Error<
|
||||
"%select{base class|inherited virtual base class}0 %1 has %select{private|"
|
||||
"protected}3 %select{constructor|copy constructor|copy assignment operator|"
|
||||
@ -507,6 +512,9 @@ def err_access_dtor_vbase :
|
||||
def err_access_dtor_temp :
|
||||
Error<"temporary of type %0 has %select{private|protected}1 destructor">,
|
||||
NoSFINAE;
|
||||
def err_access_dtor_exception :
|
||||
Error<"exception object of type %0 has %select{private|protected}1 "
|
||||
"destructor">, NoSFINAE;
|
||||
def err_access_dtor_field :
|
||||
Error<"field of type %1 has %select{private|protected}2 destructor">,
|
||||
NoSFINAE;
|
||||
@ -549,6 +557,9 @@ def err_dependent_nested_name_spec : Error<
|
||||
"parameter">;
|
||||
def err_nested_name_member_ref_lookup_ambiguous : Error<
|
||||
"lookup of %0 in member access expression is ambiguous">;
|
||||
def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
|
||||
"lookup of %0 in member access expression is ambiguous; using member of %1">,
|
||||
InGroup<AmbigMemberTemplate>;
|
||||
def note_ambig_member_ref_object_type : Note<
|
||||
"lookup in the object type %0 refers here">;
|
||||
def note_ambig_member_ref_scope : Note<
|
||||
@ -744,6 +755,13 @@ def err_temp_copy_no_viable : Error<
|
||||
"returning object|throwing object|copying member subobject|copying array "
|
||||
"element|allocating object|copying temporary|initializing base subobject|"
|
||||
"initializing vector element}0 of type %1">;
|
||||
def ext_rvalue_to_reference_temp_copy_no_viable : ExtWarn<
|
||||
"no viable constructor %select{copying variable|copying parameter|"
|
||||
"returning object|throwing object|copying member subobject|copying array "
|
||||
"element|allocating object|copying temporary|initializing base subobject|"
|
||||
"initializing vector element}0 of type %1; C++98 requires a copy "
|
||||
"constructor when binding a reference to a temporary">,
|
||||
InGroup<BindToTemporaryCopy>;
|
||||
def err_temp_copy_ambiguous : Error<
|
||||
"ambiguous constructor call when %select{copying variable|copying "
|
||||
"parameter|returning object|throwing object|copying member subobject|copying "
|
||||
@ -797,9 +815,15 @@ def err_attribute_wrong_number_arguments : Error<
|
||||
"attribute requires %0 argument(s)">;
|
||||
def err_attribute_missing_parameter_name : Error<
|
||||
"attribute requires unquoted parameter">;
|
||||
def err_attribute_invalid_vector_type : Error<"invalid vector type %0">;
|
||||
def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
|
||||
def err_attribute_argument_not_int : Error<
|
||||
"'%0' attribute requires integer constant">;
|
||||
def err_attribute_argument_outof_range : Error<
|
||||
"init_priority attribute requires integer constant between "
|
||||
"101 and 65535 inclusive">;
|
||||
def err_init_priority_object_attr : Error<
|
||||
"can only use ‘init_priority’ attribute on file-scope definitions "
|
||||
"of objects of class type">;
|
||||
def err_attribute_argument_n_not_int : Error<
|
||||
"'%0' attribute requires parameter %1 to be an integer constant">;
|
||||
def err_attribute_argument_n_not_string : Error<
|
||||
@ -838,7 +862,8 @@ def err_attribute_address_space_too_high : Error<
|
||||
def err_attribute_address_multiple_qualifiers : Error<
|
||||
"multiple address spaces specified for type">;
|
||||
def err_implicit_pointer_address_space_cast : Error<
|
||||
"illegal implicit cast between two pointers with different address spaces">;
|
||||
"illegal implicit conversion between two pointers with different address "
|
||||
"spaces">;
|
||||
def err_as_qualified_auto_decl : Error<
|
||||
"automatic variable qualified with an address space">;
|
||||
def err_arg_with_address_space : Error<
|
||||
@ -854,6 +879,8 @@ def err_attribute_aligned_not_power_of_two : Error<
|
||||
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
|
||||
"'%0' redeclared without %1 attribute: previous %1 ignored">;
|
||||
def warn_attribute_ignored : Warning<"%0 attribute ignored">;
|
||||
def warn_unknown_attribute_ignored : Warning<
|
||||
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
|
||||
def warn_attribute_precede_definition : Warning<
|
||||
"attribute declaration must precede definition">;
|
||||
def warn_attribute_void_function_method : Warning<
|
||||
@ -899,30 +926,34 @@ def err_cconv_knr : Error<
|
||||
"function with no prototype cannot use %0 calling convention">;
|
||||
def err_cconv_varargs : Error<
|
||||
"variadic function cannot use %0 calling convention">;
|
||||
def err_regparm_mismatch : Error<"function declared with with regparm(%0) "
|
||||
"attribute was previously declared %plural{0:without the regparm|1:"
|
||||
"with the regparm(1)|2:with the regparm(2)|3:with the regparm(3)|:with the"
|
||||
"regparm}1 attribute">;
|
||||
|
||||
def warn_impcast_vector_scalar : Warning<
|
||||
"implicit cast turns vector to scalar: %0 to %1">,
|
||||
"implicit conversion turns vector to scalar: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_complex_scalar : Warning<
|
||||
"implicit cast discards imaginary component: %0 to %1">,
|
||||
"implicit conversion discards imaginary component: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_float_precision : Warning<
|
||||
"implicit cast loses floating-point precision: %0 to %1">,
|
||||
"implicit conversion loses floating-point precision: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_float_integer : Warning<
|
||||
"implicit cast turns floating-point number into integer: %0 to %1">,
|
||||
"implicit conversion turns floating-point number into integer: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_integer_sign : Warning<
|
||||
"implicit cast changes signedness: %0 to %1">,
|
||||
"implicit conversion changes signedness: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_integer_sign_conditional : Warning<
|
||||
"operand of ? changes signedness: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_integer_precision : Warning<
|
||||
"implicit cast loses integer precision: %0 to %1">,
|
||||
"implicit conversion loses integer precision: %0 to %1">,
|
||||
InGroup<DiagGroup<"conversion">>, DefaultIgnore;
|
||||
def warn_impcast_integer_64_32 : Warning<
|
||||
"implicit cast loses integer precision: %0 to %1">,
|
||||
"implicit conversion loses integer precision: %0 to %1">,
|
||||
InGroup<DiagGroup<"shorten-64-to-32">>, DefaultIgnore;
|
||||
|
||||
def warn_attribute_ignored_for_field_of_type : Warning<
|
||||
@ -937,8 +968,8 @@ def warn_transparent_union_attribute_not_definition : Warning<
|
||||
"transparent_union attribute can only be applied to a union definition; "
|
||||
"attribute ignored">;
|
||||
def warn_transparent_union_attribute_floating : Warning<
|
||||
"first field of a transparent union cannot have floating point or vector "
|
||||
"type; transparent_union attribute ignored">;
|
||||
"first field of a transparent union cannot have %select{floating point|"
|
||||
"vector}0 type %1; transparent_union attribute ignored">;
|
||||
def warn_transparent_union_attribute_zero_fields : Warning<
|
||||
"transparent union definition must contain at least one field; "
|
||||
"transparent_union attribute ignored">;
|
||||
@ -1077,6 +1108,9 @@ def err_ovl_ambiguous_member_call : Error<
|
||||
"call to member function %0 is ambiguous">;
|
||||
def err_ovl_deleted_member_call : Error<
|
||||
"call to %select{unavailable|deleted}0 member function %1">;
|
||||
def note_ovl_too_many_candidates : Note<
|
||||
"remaining %0 candidate%s0 omitted; "
|
||||
"pass -fshow-overloads=all to show them">;
|
||||
def note_ovl_candidate : Note<"candidate "
|
||||
"%select{function|function|constructor|"
|
||||
"function |function |constructor |"
|
||||
@ -1084,6 +1118,10 @@ def note_ovl_candidate : Note<"candidate "
|
||||
"is the implicit copy constructor|"
|
||||
"is the implicit copy assignment operator}0%1">;
|
||||
|
||||
def warn_init_pointer_from_false : Warning<
|
||||
"initialization of pointer of type %0 from literal 'false'">,
|
||||
InGroup<BoolConversions>;
|
||||
|
||||
def note_ovl_candidate_bad_deduction : Note<
|
||||
"candidate template ignored: failed template argument deduction">;
|
||||
def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
|
||||
@ -1168,6 +1206,17 @@ def note_ovl_candidate_bad_cvr : Note<"candidate "
|
||||
"%select{const|volatile|const and volatile|restrict|const and restrict|"
|
||||
"volatile and restrict|const, volatile, and restrict}3 qualifier"
|
||||
"%select{||s||s|s|s}3">;
|
||||
def note_ovl_candidate_bad_base_to_derived_conv : Note<"candidate "
|
||||
"%select{function|function|constructor|"
|
||||
"function |function |constructor |"
|
||||
"constructor (the implicit default constructor)|"
|
||||
"constructor (the implicit copy constructor)|"
|
||||
"function (the implicit copy assignment operator)}0%1"
|
||||
" not viable: cannot %select{convert from|convert from|bind}2 "
|
||||
"%select{base class pointer|superclass|base class object of type}2 %3 to "
|
||||
"%select{derived class pointer|subclass|derived class reference}2 %4 for "
|
||||
"%ordinal5 argument">;
|
||||
|
||||
def note_ambiguous_type_conversion: Note<
|
||||
"because of ambiguity in conversion of %0 to %1">;
|
||||
def note_ovl_builtin_binary_candidate : Note<
|
||||
@ -1234,6 +1283,7 @@ def err_template_param_different_kind : Error<
|
||||
"%select{|template parameter }0redeclaration">;
|
||||
def note_template_param_different_kind : Note<
|
||||
"template parameter has a different kind in template argument">;
|
||||
|
||||
def err_template_nontype_parm_different_type : Error<
|
||||
"template non-type parameter has a different type %0 in template "
|
||||
"%select{|template parameter }1redeclaration">;
|
||||
@ -1528,6 +1578,8 @@ def err_explicit_instantiation_nontemplate_type : Error<
|
||||
"explicit instantiation of non-templated type %0">;
|
||||
def note_nontemplate_decl_here : Note<
|
||||
"non-templated declaration is here">;
|
||||
def err_explicit_instantiation_in_class : Error<
|
||||
"explicit instantiation of %0 in class scope">;
|
||||
def err_explicit_instantiation_out_of_scope : Error<
|
||||
"explicit instantiation of %0 not in a namespace enclosing %1">;
|
||||
def err_explicit_instantiation_must_be_global : Error<
|
||||
@ -1560,10 +1612,9 @@ def note_explicit_instantiation_candidate : Note<
|
||||
"explicit instantiation candidate function template here %0">;
|
||||
def err_explicit_instantiation_inline : Error<
|
||||
"explicit instantiation cannot be 'inline'">;
|
||||
def err_explicit_instantiation_without_qualified_id : Error<
|
||||
"qualifier in explicit instantiation of %q0 requires a template-id">;
|
||||
def err_explicit_instantiation_without_qualified_id_quals : Error<
|
||||
"qualifier in explicit instantiation of '%0%1' requires a template-id">;
|
||||
def ext_explicit_instantiation_without_qualified_id : ExtWarn<
|
||||
"qualifier in explicit instantiation of %q0 requires a template-id "
|
||||
"(a typedef is not permitted)">;
|
||||
def err_explicit_instantiation_unqualified_wrong_namespace : Error<
|
||||
"explicit instantiation of %q0 must occur in %1">;
|
||||
def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
|
||||
@ -1588,6 +1639,8 @@ def note_typename_refers_here : Note<
|
||||
"referenced member %0 is declared here">;
|
||||
def err_typename_missing : Error<
|
||||
"missing 'typename' prior to dependent type name '%0%1'">;
|
||||
def ext_typename_outside_of_template : ExtWarn<
|
||||
"'typename' occurs outside of a template">;
|
||||
|
||||
def err_template_kw_refers_to_non_template : Error<
|
||||
"%0 following the 'template' keyword does not refer to a template">;
|
||||
@ -1599,6 +1652,8 @@ def note_referenced_class_template : Error<
|
||||
"class template declared here">;
|
||||
def err_template_kw_missing : Error<
|
||||
"missing 'template' keyword prior to dependent template name '%0%1'">;
|
||||
def ext_template_outside_of_template : ExtWarn<
|
||||
"'template' keyword outside of a template">;
|
||||
|
||||
// C++0x Variadic Templates
|
||||
def err_template_param_pack_default_arg : Error<
|
||||
@ -1606,6 +1661,18 @@ def err_template_param_pack_default_arg : Error<
|
||||
def err_template_param_pack_must_be_last_template_parameter : Error<
|
||||
"template parameter pack must be the last template parameter">;
|
||||
|
||||
def err_template_parameter_pack_non_pack : Error<
|
||||
"template %select{type|non-type|template}0 parameter%select{| pack}1 "
|
||||
"conflicts with previous template %select{type|non-type|template}0 "
|
||||
"parameter%select{ pack|}1">;
|
||||
def note_template_parameter_pack_non_pack : Note<
|
||||
"template %select{type|non-type|template}0 parameter%select{| pack}1 "
|
||||
"does not match template %select{type|non-type|template}0 "
|
||||
"parameter%select{ pack|}1 in template argument">;
|
||||
def note_template_parameter_pack_here : Note<
|
||||
"previous template %select{type|non-type|template}0 "
|
||||
"parameter%select{| pack}1 declared here">;
|
||||
|
||||
def err_unexpected_typedef : Error<
|
||||
"unexpected type name %0: expected expression">;
|
||||
def err_unexpected_namespace : Error<
|
||||
@ -1674,6 +1741,9 @@ def ext_forward_ref_enum : Extension<
|
||||
"ISO C forbids forward references to 'enum' types">;
|
||||
def err_forward_ref_enum : Error<
|
||||
"ISO C++ forbids forward references to 'enum' types">;
|
||||
def ext_forward_ref_enum_def : Extension<
|
||||
"redeclaration of already-defined enum %0 is a GNU extension">, InGroup<GNU>;
|
||||
|
||||
def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
|
||||
def err_duplicate_member : Error<"duplicate member %0">;
|
||||
def err_misplaced_ivar : Error<
|
||||
@ -1848,6 +1918,8 @@ def err_illegal_decl_array_of_functions : Error<
|
||||
"'%0' declared as array of functions of type %1">;
|
||||
def err_illegal_decl_array_incomplete_type : Error<
|
||||
"array has incomplete element type %0">;
|
||||
def err_illegal_message_expr_incomplete_type : Error<
|
||||
"objective-c message has incomplete result type %0">;
|
||||
def err_illegal_decl_array_of_references : Error<
|
||||
"'%0' declared as array of references of type %1">;
|
||||
def err_array_star_outside_prototype : Error<
|
||||
@ -2028,6 +2100,11 @@ def err_typecheck_unary_expr : Error<
|
||||
"invalid argument type %0 to unary expression">;
|
||||
def err_typecheck_indirection_requires_pointer : Error<
|
||||
"indirection requires pointer operand (%0 invalid)">;
|
||||
def warn_indirection_through_null : Warning<
|
||||
"indirection of non-volatile null pointer will be deleted, not trap">;
|
||||
def note_indirection_through_null : Note<
|
||||
"consider using __builtin_trap() or qualifying pointer with 'volatile'">;
|
||||
|
||||
def err_indirection_requires_nonfragile_object : Error<
|
||||
"indirection cannot be to an interface in non-fragile ABI (%0 invalid)">;
|
||||
def err_direct_interface_unsupported : Error<
|
||||
@ -2046,8 +2123,12 @@ def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
|
||||
"ordered comparison of function pointers (%0 and %1)">;
|
||||
def ext_typecheck_comparison_of_fptr_to_void : Extension<
|
||||
"equality comparison between function pointer and void pointer (%0 and %1)">;
|
||||
def err_typecheck_comparison_of_fptr_to_void : Error<
|
||||
"equality comparison between function pointer and void pointer (%0 and %1)">;
|
||||
def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
|
||||
"comparison between pointer and integer (%0 and %1)">;
|
||||
def err_typecheck_comparison_of_pointer_integer : Error<
|
||||
"comparison between pointer and integer (%0 and %1)">;
|
||||
def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
|
||||
"comparison of distinct pointer types (%0 and %1)">;
|
||||
def ext_typecheck_cond_incompatible_operands : ExtWarn<
|
||||
@ -2081,9 +2162,11 @@ def err_invalid_member_use_in_static_method : Error<
|
||||
"invalid use of member %0 in static member function">;
|
||||
def err_invalid_qualified_function_type : Error<
|
||||
"type qualifier is not allowed on this function">;
|
||||
def err_invalid_qualified_function_pointer : Error<
|
||||
"type qualifier is not allowed on this function %select{pointer|reference}0">;
|
||||
def err_invalid_qualified_typedef_function_type_use : Error<
|
||||
"a qualified function type cannot be used to declare a nonmember function "
|
||||
"or a static member function">;
|
||||
"a qualified function type cannot be used to declare a "
|
||||
"%select{static member|nonmember}0 function">;
|
||||
|
||||
def err_invalid_non_static_member_use : Error<
|
||||
"invalid use of nonstatic data member %0">;
|
||||
@ -2260,13 +2343,26 @@ def err_new_array_nonconst : Error<
|
||||
"only the first dimension of an allocated array may have dynamic size">;
|
||||
def err_new_array_init_args : Error<
|
||||
"array 'new' cannot have initialization arguments">;
|
||||
def err_new_paren_array_nonconst : Error<
|
||||
def ext_new_paren_array_nonconst : ExtWarn<
|
||||
"when type is in parentheses, array cannot have dynamic size">;
|
||||
def err_placement_new_non_placement_delete : Error<
|
||||
"'new' expression with placement arguments refers to non-placement "
|
||||
"'operator delete'">;
|
||||
def err_array_size_not_integral : Error<
|
||||
"array size expression must have integral or enumerated type, not %0">;
|
||||
def err_array_size_incomplete_type : Error<
|
||||
"array size expression has incomplete class type %0">;
|
||||
def err_array_size_explicit_conversion : Error<
|
||||
"array size expression of type %0 requires explicit conversion to type %1">;
|
||||
def note_array_size_conversion : Note<
|
||||
"conversion to %select{integral|enumeration}0 type %1 declared here">;
|
||||
def err_array_size_ambiguous_conversion : Error<
|
||||
"ambiguous conversion of array size expression of type %0 to an integral or "
|
||||
"enumeration type">;
|
||||
def ext_array_size_conversion : Extension<
|
||||
"implicit conversion from array size expression of type %0 to "
|
||||
"%select{integral|enumeration}1 type %2 is a C++0x extension">;
|
||||
|
||||
def err_default_init_const : Error<
|
||||
"default initialization of an object of const type %0"
|
||||
"%select{| requires a user-provided default constructor}1">;
|
||||
@ -2866,11 +2962,17 @@ def warn_printf_asterisk_missing_arg : Warning<
|
||||
def warn_printf_asterisk_wrong_type : Warning<
|
||||
"field %select{width|precision}0 should have type %1, but argument has type %2">,
|
||||
InGroup<Format>;
|
||||
def warn_printf_nonsensical_precision: Warning<
|
||||
"precision used in '%0' conversion specifier (where it has no meaning)">,
|
||||
def warn_printf_nonsensical_optional_amount: Warning<
|
||||
"%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
|
||||
InGroup<Format>;
|
||||
def warn_printf_nonsensical_flag: Warning<
|
||||
"flag '%0' results in undefined behavior in '%1' conversion specifier">,
|
||||
"flag '%0' results in undefined behavior with '%1' conversion specifier">,
|
||||
InGroup<Format>;
|
||||
def warn_printf_nonsensical_length: Warning<
|
||||
"length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
|
||||
InGroup<Format>;
|
||||
def warn_printf_ignored_flag: Warning<
|
||||
"flag '%0' is ignored when flag '%1' is present">,
|
||||
InGroup<Format>;
|
||||
|
||||
// CHECK: returning address/reference of stack memory
|
||||
@ -2886,8 +2988,10 @@ def err_ret_local_block : Error<
|
||||
|
||||
// For non-floating point, expressions of the form x == x or x != x
|
||||
// should result in a warning, since these always evaluate to a constant.
|
||||
def warn_selfcomparison : Warning<
|
||||
"self-comparison always results in a constant value">;
|
||||
// Array comparisons have similar warnings
|
||||
def warn_comparison_always : Warning<
|
||||
"%select{self-|array }0comparison always evaluates to %select{false|true|a constant}1">;
|
||||
|
||||
def warn_stringcompare : Warning<
|
||||
"result of comparison against %select{a string literal|@encode}0 is "
|
||||
"unspecified (use strncmp instead)">;
|
||||
@ -2956,13 +3060,13 @@ def err_first_argument_to_va_arg_not_of_type_va_list : Error<
|
||||
"first argument to 'va_arg' is of type %0 and not 'va_list'">;
|
||||
|
||||
def warn_return_missing_expr : Warning<
|
||||
"non-void %select{function|method}1 %0 should return a value">,
|
||||
"non-void %select{function|method}1 %0 should return a value">, DefaultError,
|
||||
InGroup<ReturnType>;
|
||||
def ext_return_missing_expr : ExtWarn<
|
||||
"non-void %select{function|method}1 %0 should return a value">,
|
||||
"non-void %select{function|method}1 %0 should return a value">, DefaultError,
|
||||
InGroup<ReturnType>;
|
||||
def ext_return_has_expr : ExtWarn<
|
||||
"void %select{function|method}1 %0 should not return a value">,
|
||||
"void %select{function|method}1 %0 should not return a value">, DefaultError,
|
||||
InGroup<ReturnType>;
|
||||
def ext_return_has_void_expr : Extension<
|
||||
"void %select{function|method}1 %0 should not return void expression">;
|
||||
@ -2993,6 +3097,8 @@ def err_vector_incorrect_num_initializers : Error<
|
||||
"%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
|
||||
def err_altivec_empty_initializer : Error<"expected initializer">;
|
||||
|
||||
def err_invalid_neon_type_code : Error<
|
||||
"incompatible constant for this __builtin_neon function">;
|
||||
def err_argument_invalid_range : Error<
|
||||
"argument should be a value from %0 to %1">;
|
||||
|
||||
@ -3003,7 +3109,9 @@ def err_constant_integer_arg_type : Error<
|
||||
"argument to %0 must be a constant integer">;
|
||||
|
||||
def ext_mixed_decls_code : Extension<
|
||||
"ISO C90 forbids mixing declarations and code">;
|
||||
"ISO C90 forbids mixing declarations and code">,
|
||||
InGroup<DiagGroup<"declaration-after-statement">>;
|
||||
|
||||
def err_non_variable_decl_in_for : Error<
|
||||
"declaration of non-local variable in 'for' loop">;
|
||||
def err_toomany_element_decls : Error<
|
||||
@ -3094,6 +3202,11 @@ def err_undeclared_protocol_suggest : Error<
|
||||
"cannot find protocol declaration for %0; did you mean %1?">;
|
||||
def note_base_class_specified_here : Note<
|
||||
"base class %0 specified here">;
|
||||
def err_using_directive_suggest : Error<
|
||||
"no namespace named %0; did you mean %1?">;
|
||||
def err_using_directive_member_suggest : Error<
|
||||
"no namespace named %0 in %1; did you mean %2?">;
|
||||
def note_namespace_defined_here : Note<"namespace %0 defined here">;
|
||||
|
||||
} // end of sema category
|
||||
} // end of sema component.
|
||||
|
@ -89,7 +89,8 @@ public:
|
||||
// The 'this' pointer really points to a
|
||||
// std::pair<IdentifierInfo, const char*>, where internal pointer
|
||||
// points to the external string data.
|
||||
return ((std::pair<IdentifierInfo, const char*>*) this)->second;
|
||||
typedef std::pair<IdentifierInfo, const char*> actualtype;
|
||||
return ((const actualtype*) this)->second;
|
||||
}
|
||||
|
||||
/// getLength - Efficiently return the length of this identifier info.
|
||||
@ -101,7 +102,8 @@ public:
|
||||
// The 'this' pointer really points to a
|
||||
// std::pair<IdentifierInfo, const char*>, where internal pointer
|
||||
// points to the external string data.
|
||||
const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2;
|
||||
typedef std::pair<IdentifierInfo, const char*> actualtype;
|
||||
const char* p = ((const actualtype*) this)->second - 2;
|
||||
return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1;
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,6 @@ public:
|
||||
unsigned MathErrno : 1; // Math functions must respect errno
|
||||
// (modulo the platform support).
|
||||
|
||||
unsigned OverflowChecking : 1; // Extension to call a handler function when
|
||||
// signed integer arithmetic overflows.
|
||||
|
||||
unsigned HeinousExtensions : 1; // Extensions that we really don't like and
|
||||
// may be ripped out at any time.
|
||||
|
||||
@ -102,20 +99,21 @@ public:
|
||||
unsigned DumpRecordLayouts : 1; /// Dump the layout of IRgen'd records.
|
||||
unsigned DumpVTableLayouts : 1; /// Dump the layouts of emitted vtables.
|
||||
unsigned NoConstantCFStrings : 1; // Do not do CF strings
|
||||
unsigned InlineVisibilityHidden : 1; // Whether inline C++ methods have
|
||||
// hidden visibility by default.
|
||||
|
||||
unsigned SpellChecking : 1; // Whether to perform spell-checking for error
|
||||
// recovery.
|
||||
// FIXME: This is just a temporary option, for testing purposes.
|
||||
unsigned NoBitFieldTypeAlign : 1;
|
||||
|
||||
private:
|
||||
unsigned GC : 2; // Objective-C Garbage Collection modes. We
|
||||
// declare this enum as unsigned because MSVC
|
||||
// insists on making enums signed. Set/Query
|
||||
// this value using accessors.
|
||||
// We declare multibit enums as unsigned because MSVC insists on making enums
|
||||
// signed. Set/Query these values using accessors.
|
||||
unsigned GC : 2; // Objective-C Garbage Collection modes.
|
||||
unsigned SymbolVisibility : 3; // Symbol's visibility.
|
||||
unsigned StackProtector : 2; // Whether stack protectors are on. We declare
|
||||
// this enum as unsigned because MSVC insists
|
||||
// on making enums signed. Set/Query this
|
||||
// value using accessors.
|
||||
unsigned StackProtector : 2; // Whether stack protectors are on.
|
||||
unsigned SignedOverflowBehavior : 2; // How to handle signed integer overflow.
|
||||
|
||||
public:
|
||||
unsigned InstantiationDepth; // Maximum template instantiation depth.
|
||||
@ -129,13 +127,19 @@ public:
|
||||
Protected,
|
||||
Hidden
|
||||
};
|
||||
|
||||
enum SignedOverflowBehaviorTy {
|
||||
SOB_Undefined, // Default C standard behavior.
|
||||
SOB_Defined, // -fwrapv
|
||||
SOB_Trapping // -ftrapv
|
||||
};
|
||||
|
||||
LangOptions() {
|
||||
Trigraphs = BCPLComment = Bool = DollarIdents = AsmPreprocessor = 0;
|
||||
GNUMode = GNUKeywords = ImplicitInt = Digraphs = 0;
|
||||
HexFloats = 0;
|
||||
GC = ObjC1 = ObjC2 = ObjCNonFragileABI = ObjCNonFragileABI2 = 0;
|
||||
NoConstantCFStrings = 0;
|
||||
NoConstantCFStrings = 0; InlineVisibilityHidden = 0;
|
||||
C99 = Microsoft = CPlusPlus = CPlusPlus0x = 0;
|
||||
CXXOperatorNames = PascalStrings = WritableStrings = ConstStrings = 0;
|
||||
Exceptions = SjLjExceptions = Freestanding = NoBuiltin = 0;
|
||||
@ -146,20 +150,19 @@ public:
|
||||
AltiVec = OpenCL = StackProtector = 0;
|
||||
|
||||
SymbolVisibility = (unsigned) Default;
|
||||
|
||||
|
||||
ThreadsafeStatics = 1;
|
||||
POSIXThreads = 0;
|
||||
Blocks = 0;
|
||||
EmitAllDecls = 0;
|
||||
MathErrno = 1;
|
||||
|
||||
SignedOverflowBehavior = SOB_Undefined;
|
||||
|
||||
AssumeSaneOperatorNew = 1;
|
||||
|
||||
// FIXME: The default should be 1.
|
||||
AccessControl = 0;
|
||||
AccessControl = 1;
|
||||
ElideConstructors = 1;
|
||||
|
||||
OverflowChecking = 0;
|
||||
SignedOverflowBehavior = 0;
|
||||
ObjCGCBitmapPrint = 0;
|
||||
|
||||
InstantiationDepth = 1024;
|
||||
@ -178,6 +181,7 @@ public:
|
||||
CatchUndefined = 0;
|
||||
DumpRecordLayouts = 0;
|
||||
DumpVTableLayouts = 0;
|
||||
SpellChecking = 1;
|
||||
NoBitFieldTypeAlign = 0;
|
||||
}
|
||||
|
||||
@ -195,6 +199,13 @@ public:
|
||||
return (VisibilityMode) SymbolVisibility;
|
||||
}
|
||||
void setVisibilityMode(VisibilityMode v) { SymbolVisibility = (unsigned) v; }
|
||||
|
||||
SignedOverflowBehaviorTy getSignedOverflowBehavior() const {
|
||||
return (SignedOverflowBehaviorTy)SignedOverflowBehavior;
|
||||
}
|
||||
void setSignedOverflowBehavior(SignedOverflowBehaviorTy V) {
|
||||
SignedOverflowBehavior = (unsigned)V;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
@ -1,16 +1,33 @@
|
||||
LEVEL = ../../../../..
|
||||
BUILT_SOURCES = DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
|
||||
CLANG_LEVEL := ../../..
|
||||
BUILT_SOURCES = \
|
||||
DiagnosticAnalysisKinds.inc DiagnosticASTKinds.inc \
|
||||
DiagnosticCommonKinds.inc DiagnosticDriverKinds.inc \
|
||||
DiagnosticFrontendKinds.inc DiagnosticLexKinds.inc \
|
||||
DiagnosticParseKinds.inc DiagnosticSemaKinds.inc \
|
||||
DiagnosticGroups.inc
|
||||
DiagnosticGroups.inc AttrList.inc arm_neon.inc \
|
||||
Version.inc
|
||||
|
||||
TABLEGEN_INC_FILES_COMMON = 1
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
INPUT_TDS = $(wildcard $(PROJ_SRC_DIR)/Diagnostic*.td)
|
||||
|
||||
# Compute the Clang version from the LLVM version, unless specified explicitly.
|
||||
ifndef CLANG_VERSION
|
||||
CLANG_VERSION := $(subst svn,,$(LLVMVersion))
|
||||
endif
|
||||
|
||||
CLANG_VERSION_COMPONENTS := $(subst ., ,$(CLANG_VERSION))
|
||||
CLANG_VERSION_MAJOR := $(word 1,$(CLANG_VERSION_COMPONENTS))
|
||||
CLANG_VERSION_MINOR := $(word 2,$(CLANG_VERSION_COMPONENTS))
|
||||
CLANG_VERSION_PATCHLEVEL := $(word 3,$(CLANG_VERSION_COMPONENTS))
|
||||
ifeq ($(CLANG_VERSION_PATCHLEVEL),)
|
||||
CLANG_HAS_VERSION_PATCHLEVEL := 0
|
||||
else
|
||||
CLANG_HAS_VERSION_PATCHLEVEL := 1
|
||||
endif
|
||||
|
||||
$(ObjDir)/Diagnostic%Kinds.inc.tmp : Diagnostic.td Diagnostic%Kinds.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(Echo) "Building Clang $(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) diagnostic tables with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-diags-defs -clang-component=$(patsubst Diagnostic%Kinds.inc.tmp,%,$(@F)) -o $(call SYSPATH, $@) $<
|
||||
@ -19,4 +36,20 @@ $(ObjDir)/DiagnosticGroups.inc.tmp : Diagnostic.td DiagnosticGroups.td $(INPUT_T
|
||||
$(Echo) "Building Clang diagnostic groups with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-diag-groups -o $(call SYSPATH, $@) $<
|
||||
|
||||
$(ObjDir)/AttrList.inc.tmp : Attr.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(Echo) "Building Clang attribute list with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-attr-list -o $(call SYSPATH, $@) \
|
||||
-I $(PROJ_SRC_DIR)/../.. $<
|
||||
|
||||
$(ObjDir)/arm_neon.inc.tmp : arm_neon.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(Echo) "Building Clang arm_neon.inc with tblgen"
|
||||
$(Verb) $(TableGen) -gen-arm-neon-sema -o $(call SYSPATH, $@) $<
|
||||
|
||||
$(ObjDir)/Version.inc.tmp : Version.inc.in Makefile $(LLVM_OBJ_ROOT)/Makefile.config $(ObjDir)/.dir
|
||||
$(Echo) "Updating Clang version info."
|
||||
$(Verb)sed -e "s#@CLANG_VERSION@#$(CLANG_VERSION)#g" \
|
||||
-e "s#@CLANG_VERSION_MAJOR@#$(CLANG_VERSION_MAJOR)#g" \
|
||||
-e "s#@CLANG_VERSION_MINOR@#$(CLANG_VERSION_MINOR)#g" \
|
||||
-e "s#@CLANG_VERSION_PATCHLEVEL@#$(CLANG_VERSION_PATCHLEVEL)#g" \
|
||||
-e "s#@CLANG_HAS_VERSION_PATCHLEVEL@#$(CLANG_HAS_VERSION_PATCHLEVEL)#g" \
|
||||
$< > $@
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
/// DiagRanges - The list of ranges added to this diagnostic. It currently
|
||||
/// only support 10 ranges, could easily be extended if needed.
|
||||
SourceRange DiagRanges[10];
|
||||
CharSourceRange DiagRanges[10];
|
||||
|
||||
enum { MaxFixItHints = 3 };
|
||||
|
||||
@ -142,7 +142,7 @@ private:
|
||||
DiagStorage = 0;
|
||||
}
|
||||
|
||||
void AddSourceRange(const SourceRange &R) const {
|
||||
void AddSourceRange(const CharSourceRange &R) const {
|
||||
if (!DiagStorage)
|
||||
DiagStorage = getStorage();
|
||||
|
||||
@ -264,10 +264,16 @@ public:
|
||||
|
||||
friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
|
||||
const SourceRange &R) {
|
||||
PD.AddSourceRange(R);
|
||||
PD.AddSourceRange(CharSourceRange::getTokenRange(R));
|
||||
return PD;
|
||||
}
|
||||
|
||||
friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
|
||||
const CharSourceRange &R) {
|
||||
PD.AddSourceRange(R);
|
||||
return PD;
|
||||
}
|
||||
|
||||
friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
|
||||
const FixItHint &Hint) {
|
||||
PD.AddFixItHint(Hint);
|
||||
|
@ -172,6 +172,56 @@ public:
|
||||
return B != X.B || E != X.E;
|
||||
}
|
||||
};
|
||||
|
||||
/// CharSourceRange - This class represents a character granular source range.
|
||||
/// The underlying SourceRange can either specify the starting/ending character
|
||||
/// of the range, or it can specify the start or the range and the start of the
|
||||
/// last token of the range (a "token range"). In the token range case, the
|
||||
/// size of the last token must be measured to determine the actual end of the
|
||||
/// range.
|
||||
class CharSourceRange {
|
||||
SourceRange Range;
|
||||
bool IsTokenRange;
|
||||
public:
|
||||
CharSourceRange() : IsTokenRange(false) {}
|
||||
CharSourceRange(SourceRange R, bool ITR) : Range(R),IsTokenRange(ITR){}
|
||||
|
||||
static CharSourceRange getTokenRange(SourceRange R) {
|
||||
CharSourceRange Result;
|
||||
Result.Range = R;
|
||||
Result.IsTokenRange = true;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static CharSourceRange getCharRange(SourceRange R) {
|
||||
CharSourceRange Result;
|
||||
Result.Range = R;
|
||||
Result.IsTokenRange = false;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static CharSourceRange getTokenRange(SourceLocation B, SourceLocation E) {
|
||||
return getTokenRange(SourceRange(B, E));
|
||||
}
|
||||
static CharSourceRange getCharRange(SourceLocation B, SourceLocation E) {
|
||||
return getCharRange(SourceRange(B, E));
|
||||
}
|
||||
|
||||
/// isTokenRange - Return true if the end of this range specifies the start of
|
||||
/// the last token. Return false if the end of this range specifies the last
|
||||
/// character in the range.
|
||||
bool isTokenRange() const { return IsTokenRange; }
|
||||
|
||||
SourceLocation getBegin() const { return Range.getBegin(); }
|
||||
SourceLocation getEnd() const { return Range.getEnd(); }
|
||||
const SourceRange &getAsRange() const { return Range; }
|
||||
|
||||
void setBegin(SourceLocation b) { Range.setBegin(b); }
|
||||
void setEnd(SourceLocation e) { Range.setEnd(e); }
|
||||
|
||||
bool isValid() const { return Range.isValid(); }
|
||||
bool isInvalid() const { return !isValid(); }
|
||||
};
|
||||
|
||||
/// FullSourceLoc - A SourceLocation and its associated SourceManager. Useful
|
||||
/// for argument passing to functions that expect both objects.
|
||||
|
@ -1,4 +1,6 @@
|
||||
class Stmt<bit abstract = 0> {
|
||||
class AttrSubject;
|
||||
|
||||
class Stmt<bit abstract = 0> : AttrSubject {
|
||||
bit Abstract = abstract;
|
||||
}
|
||||
|
||||
@ -93,11 +95,10 @@ def CXXNullPtrLiteralExpr : DStmt<Expr>;
|
||||
def CXXThisExpr : DStmt<Expr>;
|
||||
def CXXThrowExpr : DStmt<Expr>;
|
||||
def CXXDefaultArgExpr : DStmt<Expr>;
|
||||
def CXXZeroInitValueExpr : DStmt<Expr>;
|
||||
def CXXScalarValueInitExpr : DStmt<Expr>;
|
||||
def CXXNewExpr : DStmt<Expr>;
|
||||
def CXXDeleteExpr : DStmt<Expr>;
|
||||
def CXXPseudoDestructorExpr : DStmt<Expr>;
|
||||
def UnresolvedLookupExpr : DStmt<Expr>;
|
||||
def UnaryTypeTraitExpr : DStmt<Expr>;
|
||||
def DependentScopeDeclRefExpr : DStmt<Expr>;
|
||||
def CXXConstructExpr : DStmt<Expr>;
|
||||
@ -107,7 +108,9 @@ def CXXExprWithTemporaries : DStmt<Expr>;
|
||||
def CXXTemporaryObjectExpr : DStmt<CXXConstructExpr>;
|
||||
def CXXUnresolvedConstructExpr : DStmt<Expr>;
|
||||
def CXXDependentScopeMemberExpr : DStmt<Expr>;
|
||||
def UnresolvedMemberExpr : DStmt<Expr>;
|
||||
def OverloadExpr : DStmt<Expr, 1>;
|
||||
def UnresolvedLookupExpr : DStmt<OverloadExpr>;
|
||||
def UnresolvedMemberExpr : DStmt<OverloadExpr>;
|
||||
|
||||
// Obj-C Expressions.
|
||||
def ObjCStringLiteral : DStmt<Expr>;
|
@ -51,12 +51,14 @@ protected:
|
||||
unsigned char FloatWidth, FloatAlign;
|
||||
unsigned char DoubleWidth, DoubleAlign;
|
||||
unsigned char LongDoubleWidth, LongDoubleAlign;
|
||||
unsigned char LargeArrayMinWidth, LargeArrayAlign;
|
||||
unsigned char LongWidth, LongAlign;
|
||||
unsigned char LongLongWidth, LongLongAlign;
|
||||
const char *DescriptionString;
|
||||
const char *UserLabelPrefix;
|
||||
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
|
||||
unsigned char RegParmMax, SSERegParmMax;
|
||||
std::string CXXABI;
|
||||
|
||||
unsigned HasAlignMac68kSupport : 1;
|
||||
|
||||
@ -194,6 +196,11 @@ public:
|
||||
return *LongDoubleFormat;
|
||||
}
|
||||
|
||||
// getLargeArrayMinWidth/Align - Return the minimum array size that is
|
||||
// 'large' and its alignment.
|
||||
unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
|
||||
unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
|
||||
|
||||
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
|
||||
/// target, in bits.
|
||||
unsigned getIntMaxTWidth() const {
|
||||
@ -390,6 +397,11 @@ public:
|
||||
return "";
|
||||
}
|
||||
|
||||
/// getCXXABI - Get the C++ ABI in use.
|
||||
virtual llvm::StringRef getCXXABI() const {
|
||||
return CXXABI;
|
||||
}
|
||||
|
||||
/// setCPU - Target the specific CPU.
|
||||
///
|
||||
/// \return - False on error (invalid CPU name).
|
||||
@ -406,6 +418,16 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/// setCXXABI - Use this specific C++ ABI.
|
||||
///
|
||||
/// \return - False on error (invalid ABI name).
|
||||
virtual bool setCXXABI(const std::string &Name) {
|
||||
if (Name != "itanium" && Name != "microsoft")
|
||||
return false;
|
||||
CXXABI = Name;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// setFeatureEnabled - Enable or disable a specific target feature,
|
||||
/// the feature name must be valid.
|
||||
///
|
||||
@ -450,7 +472,12 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/// getStaticInitSectionSpecifier - Return the section to use for C++ static
|
||||
/// initialization functions.
|
||||
virtual const char *getStaticInitSectionSpecifier() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
|
||||
return PointerWidth;
|
||||
|
@ -19,6 +19,10 @@ namespace clang {
|
||||
class TargetOptions {
|
||||
public:
|
||||
|
||||
TargetOptions() {
|
||||
CXXABI = "itanium";
|
||||
}
|
||||
|
||||
/// If given, the name of the target triple to compile for. If not given the
|
||||
/// target will be selected to match the host.
|
||||
std::string Triple;
|
||||
@ -29,6 +33,10 @@ public:
|
||||
/// If given, the name of the target ABI to use.
|
||||
std::string ABI;
|
||||
|
||||
/// If given, the name of the target C++ ABI to use. If not given, defaults
|
||||
/// to "itanium".
|
||||
std::string CXXABI;
|
||||
|
||||
/// The list of target specific features to enable or disable -- this should
|
||||
/// be a list of strings starting with by '+' or '-'.
|
||||
std::vector<std::string> Features;
|
||||
|
@ -17,15 +17,7 @@
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
/// \brief Clang major version
|
||||
#define CLANG_VERSION_MAJOR 2
|
||||
|
||||
// FIXME: Updates to this file must also update CMakeLists.txt and VER.
|
||||
/// \brief Clang minor version
|
||||
#define CLANG_VERSION_MINOR 0
|
||||
|
||||
/// \brief Clang patchlevel version
|
||||
// #define CLANG_VERSION_PATCHLEVEL 1
|
||||
#include "clang/Basic/Version.inc"
|
||||
|
||||
/// \brief Helper macro for CLANG_VERSION_STRING.
|
||||
#define CLANG_MAKE_VERSION_STRING2(X) #X
|
||||
|
6
include/clang/Basic/Version.inc.in
Normal file
6
include/clang/Basic/Version.inc.in
Normal file
@ -0,0 +1,6 @@
|
||||
#define CLANG_VERSION @CLANG_VERSION@
|
||||
#define CLANG_VERSION_MAJOR @CLANG_VERSION_MAJOR@
|
||||
#define CLANG_VERSION_MINOR @CLANG_VERSION_MINOR@
|
||||
#if @CLANG_HAS_VERSION_PATCHLEVEL@
|
||||
#define CLANG_VERSION_PATCHLEVEL @CLANG_VERSION_PATCHLEVEL@
|
||||
#endif
|
341
include/clang/Basic/arm_neon.td
Normal file
341
include/clang/Basic/arm_neon.td
Normal file
@ -0,0 +1,341 @@
|
||||
//===--- arm_neon.td - ARM NEON compiler interface ------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the TableGen definitions from which the ARM NEON header
|
||||
// file will be generated. See ARM document DUI0348B.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class Op;
|
||||
|
||||
def OP_NONE : Op;
|
||||
def OP_ADD : Op;
|
||||
def OP_SUB : Op;
|
||||
def OP_MUL : Op;
|
||||
def OP_MLA : Op;
|
||||
def OP_MLS : Op;
|
||||
def OP_MUL_N : Op;
|
||||
def OP_MLA_N : Op;
|
||||
def OP_MLS_N : Op;
|
||||
def OP_EQ : Op;
|
||||
def OP_GE : Op;
|
||||
def OP_LE : Op;
|
||||
def OP_GT : Op;
|
||||
def OP_LT : Op;
|
||||
def OP_NEG : Op;
|
||||
def OP_NOT : Op;
|
||||
def OP_AND : Op;
|
||||
def OP_OR : Op;
|
||||
def OP_XOR : Op;
|
||||
def OP_ANDN : Op;
|
||||
def OP_ORN : Op;
|
||||
def OP_CAST : Op;
|
||||
def OP_HI : Op;
|
||||
def OP_LO : Op;
|
||||
def OP_CONC : Op;
|
||||
def OP_DUP : Op;
|
||||
def OP_SEL : Op;
|
||||
def OP_REV64 : Op;
|
||||
def OP_REV32 : Op;
|
||||
def OP_REV16 : Op;
|
||||
|
||||
class Inst <string p, string t, Op o> {
|
||||
string Prototype = p;
|
||||
string Types = t;
|
||||
Op Operand = o;
|
||||
bit isShift = 0;
|
||||
}
|
||||
|
||||
// Used to generate Builtins.def
|
||||
class SInst<string p, string t> : Inst<p, t, OP_NONE> {}
|
||||
class IInst<string p, string t> : Inst<p, t, OP_NONE> {}
|
||||
class WInst<string p, string t> : Inst<p, t, OP_NONE> {}
|
||||
|
||||
// prototype: return (arg, arg, ...)
|
||||
// v: void
|
||||
// t: best-fit integer (int/poly args)
|
||||
// x: signed integer (int/float args)
|
||||
// u: unsigned integer (int/float args)
|
||||
// f: float (int args)
|
||||
// d: default
|
||||
// w: double width elements, same num elts
|
||||
// n: double width elements, half num elts
|
||||
// h: half width elements, double num elts
|
||||
// e: half width elements, double num elts, unsigned
|
||||
// i: constant int
|
||||
// l: constant uint64
|
||||
// s: scalar of element type
|
||||
// a: scalar of element type (splat to vector type)
|
||||
// k: default elt width, double num elts
|
||||
// #: array of default vectors
|
||||
// p: pointer type
|
||||
// c: const pointer type
|
||||
|
||||
// sizes:
|
||||
// c: char
|
||||
// s: short
|
||||
// i: int
|
||||
// l: long
|
||||
// f: float
|
||||
// h: half-float
|
||||
|
||||
// size modifiers:
|
||||
// U: unsigned
|
||||
// Q: 128b
|
||||
// P: polynomial
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.1 Addition
|
||||
def VADD : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_ADD>;
|
||||
def VADDL : SInst<"wdd", "csiUcUsUi">;
|
||||
def VADDW : SInst<"wwd", "csiUcUsUi">;
|
||||
def VHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VRHADD : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VQADD : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VADDHN : IInst<"dww", "csiUcUsUi">;
|
||||
def VRADDHN : IInst<"dww", "csiUcUsUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.2 Multiplication
|
||||
def VMUL : Inst<"ddd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_MUL>;
|
||||
def VMLA : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLA>;
|
||||
def VMLAL : SInst<"wwdd", "csiUcUsUi">;
|
||||
def VMLS : Inst<"dddd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_MLS>;
|
||||
def VMLSL : SInst<"wwdd", "csiUcUsUi">;
|
||||
def VQDMULH : SInst<"ddd", "siQsQi">;
|
||||
def VQRDMULH : SInst<"ddd", "siQsQi">;
|
||||
def VQDMLAL : SInst<"wwdd", "si">;
|
||||
def VQDMLSL : SInst<"wwdd", "si">;
|
||||
def VMULL : SInst<"wdd", "csiUcUsUiPc">;
|
||||
def VQDMULL : SInst<"wdd", "si">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.3 Subtraction
|
||||
def VSUB : Inst<"ddd", "csilfUcUsUiUlQcQsQiQlQfQUcQUsQUiQUl", OP_SUB>;
|
||||
def VSUBL : SInst<"wdd", "csiUcUsUi">;
|
||||
def VSUBW : SInst<"wwd", "csiUcUsUi">;
|
||||
def VQSUB : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VHSUB : SInst<"ddd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VSUBHN : IInst<"dww", "csiUcUsUi">;
|
||||
def VRSUBHN : IInst<"dww", "csiUcUsUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.4 Comparison
|
||||
def VCEQ : Inst<"udd", "csifUcUsUiPcQcQsQiQfQUcQUsQUiQPc", OP_EQ>;
|
||||
def VCGE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GE>;
|
||||
def VCLE : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LE>;
|
||||
def VCGT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_GT>;
|
||||
def VCLT : Inst<"udd", "csifUcUsUiQcQsQiQfQUcQUsQUi", OP_LT>;
|
||||
def VCAGE : IInst<"udd", "fQf">;
|
||||
def VCALE : IInst<"udd", "fQf">;
|
||||
def VCAGT : IInst<"udd", "fQf">;
|
||||
def VCALT : IInst<"udd", "fQf">;
|
||||
def VTST : WInst<"udd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.5 Absolute Difference
|
||||
def VABD : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">;
|
||||
def VABDL : SInst<"wdd", "csiUcUsUi">;
|
||||
def VABA : SInst<"dddd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VABAL : SInst<"wwdd", "csiUcUsUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.6 Max/Min
|
||||
def VMAX : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">;
|
||||
def VMIN : SInst<"ddd", "csiUcUsUifQcQsQiQUcQUsQUiQf">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.7 Pairdise Addition
|
||||
def VPADD : IInst<"ddd", "csiUcUsUif">;
|
||||
def VPADDL : SInst<"nd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VPADAL : SInst<"nnd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.8-9 Folding Max/Min
|
||||
def VPMAX : SInst<"ddd", "csiUcUsUif">;
|
||||
def VPMIN : SInst<"ddd", "csiUcUsUif">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.10 Reciprocal/Sqrt
|
||||
def VRECPS : IInst<"ddd", "fQf">;
|
||||
def VRSQRTS : IInst<"ddd", "fQf">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.11 Shifts by signed variable
|
||||
def VSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VQSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VQRSHL : SInst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.12 Shifts by constant
|
||||
let isShift = 1 in {
|
||||
def VSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VSHL_N : IInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VRSHR_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VRSRA_N : SInst<"dddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VQSHL_N : SInst<"ddi", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl">;
|
||||
def VQSHLU_N : SInst<"udi", "csilQcQsQiQl">;
|
||||
def VSHRN_N : IInst<"hki", "silUsUiUl">;
|
||||
def VQSHRUN_N : SInst<"eki", "sil">;
|
||||
def VQRSHRUN_N : SInst<"eki", "sil">;
|
||||
def VQSHRN_N : SInst<"hki", "silUsUiUl">;
|
||||
def VRSHRN_N : IInst<"hki", "silUsUiUl">;
|
||||
def VQRSHRN_N : SInst<"hki", "silUsUiUl">;
|
||||
def VSHLL_N : SInst<"wdi", "csiUcUsUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.13 Shifts with insert
|
||||
def VSRI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">;
|
||||
def VSLI_N : WInst<"dddi", "csilUcUsUiUlPcPsQcQsQiQlQUcQUsQUiQUlQPcQPs">;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.14 Loads and stores of a single vector
|
||||
def VLD1 : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VLD1_LANE : WInst<"dcdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VLD1_DUP : WInst<"dc", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VST1 : WInst<"vpd", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VST1_LANE : WInst<"vpdi", "QUcQUsQUiQUlQcQsQiQlQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.15 Loads and stores of an N-element structure
|
||||
def VLD2 : WInst<"2c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VLD3 : WInst<"3c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VLD4 : WInst<"4c", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VLD2_DUP : WInst<"2c", "UcUsUiUlcsilhfPcPs">;
|
||||
def VLD3_DUP : WInst<"3c", "UcUsUiUlcsilhfPcPs">;
|
||||
def VLD4_DUP : WInst<"4c", "UcUsUiUlcsilhfPcPs">;
|
||||
def VLD2_LANE : WInst<"2c2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
def VLD3_LANE : WInst<"3c3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
def VLD4_LANE : WInst<"4c4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
def VST2 : WInst<"vp2", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VST3 : WInst<"vp3", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VST4 : WInst<"vp4", "QUcQUsQUiQcQsQiQhQfQPcQPsUcUsUiUlcsilhfPcPs">;
|
||||
def VST2_LANE : WInst<"vp2i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
def VST3_LANE : WInst<"vp3i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
def VST4_LANE : WInst<"vp4i", "QUsQUiQsQiQhQfQPsUcUsUicsihfPcPs">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.16 Extract lanes from a vector
|
||||
def VGET_LANE : IInst<"sdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.17 Set lanes within a vector
|
||||
def VSET_LANE : IInst<"dsdi", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.18 Initialize a vector from bit pattern
|
||||
def VCREATE: Inst<"dl", "csihfUcUsUiUlPcPsl", OP_CAST>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.19 Set all lanes to same value
|
||||
def VDUP_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>;
|
||||
def VMOV_N : Inst<"ds", "UcUsUicsiPcPsfQUcQUsQUiQcQsQiQPcQPsQflUlQlQUl", OP_DUP>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.20 Combining vectors
|
||||
def VCOMBINE : Inst<"kdd", "csilhfUcUsUiUlPcPs", OP_CONC>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.21 Splitting vectors
|
||||
def VGET_HIGH : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_HI>;
|
||||
def VGET_LOW : Inst<"dk", "csilhfUcUsUiUlPcPs", OP_LO>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.22 Converting vectors
|
||||
def VCVT_S32 : SInst<"xd", "fQf">;
|
||||
def VCVT_U32 : SInst<"ud", "fQf">;
|
||||
def VCVT_F16 : SInst<"hk", "f">;
|
||||
def VCVT_N_S32 : SInst<"xdi", "fQf">;
|
||||
def VCVT_N_U32 : SInst<"udi", "fQf">;
|
||||
def VCVT_F32 : SInst<"fd", "iUiQiQUi">;
|
||||
def VCVT_F32_F16 : SInst<"kh", "f">;
|
||||
def VCVT_N_F32 : SInst<"fdi", "iUiQiQUi">;
|
||||
def VMOVN : IInst<"hk", "silUsUiUl">;
|
||||
def VMOVL : SInst<"wd", "csiUcUsUi">;
|
||||
def VQMOVN : SInst<"hk", "silUsUiUl">;
|
||||
def VQMOVUN : SInst<"ek", "sil">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.23-24 Table lookup, Extended table lookup
|
||||
def VTBL1 : WInst<"ddt", "UccPc">;
|
||||
def VTBL2 : WInst<"d2t", "UccPc">;
|
||||
def VTBL3 : WInst<"d3t", "UccPc">;
|
||||
def VTBL4 : WInst<"d4t", "UccPc">;
|
||||
def VTBX1 : WInst<"dddt", "UccPc">;
|
||||
def VTBX2 : WInst<"dd2t", "UccPc">;
|
||||
def VTBX3 : WInst<"dd3t", "UccPc">;
|
||||
def VTBX4 : WInst<"dd4t", "UccPc">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.25 Operations with a scalar value
|
||||
def VMLA_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">;
|
||||
def VMLAL_LANE : SInst<"wwddi", "siUsUi">;
|
||||
def VQDMLAL_LANE : SInst<"wwddi", "si">;
|
||||
def VMLS_LANE : IInst<"ddddi", "siUsUifQsQiQUsQUiQf">;
|
||||
def VMLSL_LANE : SInst<"wwddi", "siUsUi">;
|
||||
def VQDMLSL_LANE : SInst<"wwddi", "si">;
|
||||
def VMUL_N : Inst<"dds", "sifUsUiQsQiQfQUsQUi", OP_MUL_N>;
|
||||
def VMULL_N : SInst<"wda", "siUsUi">;
|
||||
def VMULL_LANE : SInst<"wddi", "siUsUi">;
|
||||
def VQDMULL_N : SInst<"wda", "si">;
|
||||
def VQDMULL_LANE : SInst<"wddi", "si">;
|
||||
def VQDMULH_N : SInst<"dda", "siQsQi">;
|
||||
def VQDMULH_LANE : SInst<"dddi", "siQsQi">;
|
||||
def VQRDMULH_N : SInst<"dda", "siQsQi">;
|
||||
def VQRDMULH_LANE : SInst<"dddi", "siQsQi">;
|
||||
def VMLA_N : Inst<"ddda", "siUsUifQsQiQUsQUiQf", OP_MLA_N>;
|
||||
def VMLAL_N : SInst<"wwda", "siUsUi">;
|
||||
def VQDMLAL_N : SInst<"wwda", "si">;
|
||||
def VMLS_N : Inst<"ddds", "siUsUifQsQiQUsQUiQf", OP_MLS_N>;
|
||||
def VMLSL_N : SInst<"wwda", "siUsUi">;
|
||||
def VQDMLSL_N : SInst<"wwda", "si">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.26 Vector Extract
|
||||
def VEXT : WInst<"dddi", "cUcPcsUsPsiUilUlQcQUcQPcQsQUsQPsQiQUiQlQUl">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.27 Reverse vector elements (sdap endianness)
|
||||
def VREV64 : Inst<"dd", "csiUcUsUiPcPsfQcQsQiQUcQUsQUiQPcQPsQf", OP_REV64>;
|
||||
def VREV32 : Inst<"dd", "csUcUsPcQcQsQUcQUsQPc", OP_REV32>;
|
||||
def VREV16 : Inst<"dd", "cUcPcQcQUcQPc", OP_REV16>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.28 Other single operand arithmetic
|
||||
def VABS : SInst<"dd", "csifQcQsQiQf">;
|
||||
def VQABS : SInst<"dd", "csiQcQsQi">;
|
||||
def VNEG : Inst<"dd", "csifQcQsQiQf", OP_NEG>;
|
||||
def VQNEG : SInst<"dd", "csiQcQsQi">;
|
||||
def VCLS : SInst<"dd", "csiQcQsQi">;
|
||||
def VCLZ : IInst<"dd", "csiUcUsUiQcQsQiQUcQUsQUi">;
|
||||
def VCNT : WInst<"dd", "UccPcQUcQcQPc">;
|
||||
def VRECPE : SInst<"dd", "fUiQfQUi">;
|
||||
def VRSQRTE : SInst<"dd", "fUiQfQUi">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.29 Logical operations
|
||||
def VMVN : Inst<"dd", "csiUcUsUiPcQcQsQiQUcQUsQUiQPc", OP_NOT>;
|
||||
def VAND : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_AND>;
|
||||
def VORR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_OR>;
|
||||
def VEOR : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_XOR>;
|
||||
def VBIC : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ANDN>;
|
||||
def VORN : Inst<"ddd", "csilUcUsUiUlQcQsQiQlQUcQUsQUiQUl", OP_ORN>;
|
||||
def VBSL : Inst<"dudd", "csilUcUsUiUlfPcPsQcQsQiQlQUcQUsQUiQUlQfQPcQPs", OP_SEL>;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.30 Transposition operations
|
||||
def VTRN: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">;
|
||||
def VZIP: WInst<"2dd", "csUcUsfPcPsQcQsQiQUcQUsQUiQfQPcQPs">;
|
||||
def VUZP: WInst<"2dd", "csiUcUsUifPcPsQcQsQiQUcQUsQUiQfQPcQPs">;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// E.3.31 Vector reinterpret cast operations
|
35
include/clang/Checker/AnalysisConsumer.h
Normal file
35
include/clang/Checker/AnalysisConsumer.h
Normal file
@ -0,0 +1,35 @@
|
||||
//===--- AnalysisConsumer.h - Front-end Analysis Engine Hooks ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header contains the functions necessary for a front-end to run various
|
||||
// analyses.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_CHECKER_ANALYSISCONSUMER_H
|
||||
#define LLVM_CLANG_CHECKER_ANALYSISCONSUMER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace clang {
|
||||
|
||||
class AnalyzerOptions;
|
||||
class ASTConsumer;
|
||||
class Preprocessor;
|
||||
|
||||
/// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
|
||||
/// analysis passes. (The set of analyses run is controlled by command-line
|
||||
/// options.)
|
||||
ASTConsumer* CreateAnalysisConsumer(const Preprocessor &pp,
|
||||
const std::string &output,
|
||||
const AnalyzerOptions& Opts);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -70,6 +70,7 @@ protected:
|
||||
|
||||
virtual void Profile(llvm::FoldingSetNodeID& hash) const {
|
||||
hash.AddInteger(getLocation().getRawEncoding());
|
||||
hash.AddString(Description);
|
||||
}
|
||||
|
||||
public:
|
||||
|
29
include/clang/Checker/FrontendActions.h
Normal file
29
include/clang/Checker/FrontendActions.h
Normal file
@ -0,0 +1,29 @@
|
||||
//===-- FrontendActions.h - Useful Frontend Actions -------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_CHECKER_FRONTENDACTIONS_H
|
||||
#define LLVM_CLANG_CHECKER_FRONTENDACTIONS_H
|
||||
|
||||
#include "clang/Frontend/FrontendAction.h"
|
||||
|
||||
namespace clang {
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AST Consumer Actions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class AnalysisAction : public ASTFrontendAction {
|
||||
protected:
|
||||
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
|
||||
llvm::StringRef InFile);
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
@ -11,8 +11,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_FRONTEND_PATH_DIAGNOSTIC_CLIENTS_H
|
||||
#define LLVM_CLANG_FRONTEND_PATH_DIAGNOSTIC_CLiENTS_H
|
||||
#ifndef LLVM_CLANG_CHECKER_PATH_DIAGNOSTIC_CLIENTS_H
|
||||
#define LLVM_CLANG_CHECKER_PATH_DIAGNOSTIC_CLiENTS_H
|
||||
|
||||
#include <string>
|
||||
|
@ -37,17 +37,21 @@ class CheckerContext {
|
||||
const Stmt *statement;
|
||||
const unsigned size;
|
||||
bool DoneEvaluating; // FIXME: This is not a permanent API change.
|
||||
public:
|
||||
bool *respondsToCallback;
|
||||
public:
|
||||
CheckerContext(ExplodedNodeSet &dst, GRStmtNodeBuilder &builder,
|
||||
GRExprEngine &eng, ExplodedNode *pred,
|
||||
const void *tag, ProgramPoint::Kind K,
|
||||
bool *respondsToCB = 0,
|
||||
const Stmt *stmt = 0, const GRState *st = 0)
|
||||
: Dst(dst), B(builder), Eng(eng), Pred(pred),
|
||||
OldSink(B.BuildSinks),
|
||||
OldTag(B.Tag, tag),
|
||||
OldPointKind(B.PointKind, K),
|
||||
OldHasGen(B.HasGeneratedNode),
|
||||
ST(st), statement(stmt), size(Dst.size()) {}
|
||||
ST(st), statement(stmt), size(Dst.size()),
|
||||
respondsToCallback(respondsToCB) {}
|
||||
|
||||
~CheckerContext();
|
||||
|
||||
@ -144,6 +148,7 @@ public:
|
||||
// If the 'state' is not new, we need to check if the cached state 'ST'
|
||||
// is new.
|
||||
if (state != getState() || (ST && ST != B.GetState(Pred)))
|
||||
// state is new or equals to ST.
|
||||
GenerateNode(state, true);
|
||||
else
|
||||
Dst.Add(Pred);
|
||||
@ -188,10 +193,11 @@ private:
|
||||
GRStmtNodeBuilder &Builder,
|
||||
GRExprEngine &Eng,
|
||||
const Stmt *S,
|
||||
ExplodedNode *Pred, void *tag, bool isPrevisit) {
|
||||
ExplodedNode *Pred, void *tag, bool isPrevisit,
|
||||
bool& respondsToCallback) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag,
|
||||
isPrevisit ? ProgramPoint::PreStmtKind :
|
||||
ProgramPoint::PostStmtKind, S);
|
||||
ProgramPoint::PostStmtKind, &respondsToCallback, S);
|
||||
if (isPrevisit)
|
||||
_PreVisit(C, S);
|
||||
else
|
||||
@ -202,7 +208,7 @@ private:
|
||||
GRExprEngine &Eng, const ObjCMessageExpr *ME,
|
||||
ExplodedNode *Pred, const GRState *state, void *tag) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag, ProgramPoint::PostStmtKind,
|
||||
ME, state);
|
||||
0, ME, state);
|
||||
return EvalNilReceiver(C, ME);
|
||||
}
|
||||
|
||||
@ -210,7 +216,7 @@ private:
|
||||
GRExprEngine &Eng, const CallExpr *CE,
|
||||
ExplodedNode *Pred, void *tag) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag, ProgramPoint::PostStmtKind,
|
||||
CE);
|
||||
0, CE);
|
||||
return EvalCallExpr(C, CE);
|
||||
}
|
||||
|
||||
@ -223,7 +229,7 @@ private:
|
||||
bool isPrevisit) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag,
|
||||
isPrevisit ? ProgramPoint::PreStmtKind :
|
||||
ProgramPoint::PostStmtKind, StoreE);
|
||||
ProgramPoint::PostStmtKind, 0, StoreE);
|
||||
assert(isPrevisit && "Only previsit supported for now.");
|
||||
PreVisitBind(C, AssignE, StoreE, location, val);
|
||||
}
|
||||
@ -238,7 +244,7 @@ private:
|
||||
void *tag, bool isLoad) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag,
|
||||
isLoad ? ProgramPoint::PreLoadKind :
|
||||
ProgramPoint::PreStoreKind, S, state);
|
||||
ProgramPoint::PreStoreKind, 0, S, state);
|
||||
VisitLocation(C, S, location);
|
||||
}
|
||||
|
||||
@ -246,8 +252,8 @@ private:
|
||||
GRExprEngine &Eng, const Stmt *S, ExplodedNode *Pred,
|
||||
SymbolReaper &SymReaper, void *tag) {
|
||||
CheckerContext C(Dst, Builder, Eng, Pred, tag,
|
||||
ProgramPoint::PostPurgeDeadSymbolsKind, S);
|
||||
EvalDeadSymbols(C, S, SymReaper);
|
||||
ProgramPoint::PostPurgeDeadSymbolsKind, 0, S);
|
||||
EvalDeadSymbols(C, SymReaper);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -257,8 +263,7 @@ public:
|
||||
virtual void VisitLocation(CheckerContext &C, const Stmt *S, SVal location) {}
|
||||
virtual void PreVisitBind(CheckerContext &C, const Stmt *AssignE,
|
||||
const Stmt *StoreE, SVal location, SVal val) {}
|
||||
virtual void EvalDeadSymbols(CheckerContext &C, const Stmt *S,
|
||||
SymbolReaper &SymReaper) {}
|
||||
virtual void EvalDeadSymbols(CheckerContext &C, SymbolReaper &SymReaper) {}
|
||||
virtual void EvalEndPath(GREndPathNodeBuilder &B, void *tag,
|
||||
GRExprEngine &Eng) {}
|
||||
|
||||
@ -278,6 +283,9 @@ public:
|
||||
bool Assumption) {
|
||||
return state;
|
||||
}
|
||||
|
||||
virtual void VisitEndAnalysis(ExplodedGraph &G, BugReporter &B,
|
||||
bool hasWorkRemaining) {}
|
||||
};
|
||||
} // end clang namespace
|
||||
|
||||
|
@ -79,8 +79,13 @@ break;
|
||||
}
|
||||
}
|
||||
|
||||
void PreVisitStmt(CheckerContext &C, const Stmt *S) {}
|
||||
void PostVisitStmt(CheckerContext &C, const Stmt *S) {}
|
||||
void PreVisitStmt(CheckerContext &C, const Stmt *S) {
|
||||
*C.respondsToCallback = false;
|
||||
}
|
||||
|
||||
void PostVisitStmt(CheckerContext &C, const Stmt *S) {
|
||||
*C.respondsToCallback = false;
|
||||
}
|
||||
|
||||
void PreVisitCastExpr(CheckerContext &C, const CastExpr *E) {
|
||||
static_cast<ImplClass*>(this)->PreVisitStmt(C, E);
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
Environment BindExpr(Environment Env, const Stmt *S, SVal V,
|
||||
bool Invalidate);
|
||||
|
||||
Environment RemoveDeadBindings(Environment Env, const Stmt *S,
|
||||
Environment RemoveDeadBindings(Environment Env,
|
||||
SymbolReaper &SymReaper, const GRState *ST,
|
||||
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
|
||||
};
|
||||
|
@ -36,7 +36,6 @@ namespace clang {
|
||||
|
||||
class GRState;
|
||||
class CFG;
|
||||
class ASTContext;
|
||||
class ExplodedGraph;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -240,9 +239,6 @@ protected:
|
||||
/// and successor groups.
|
||||
BumpVectorContext BVC;
|
||||
|
||||
/// Ctx - The ASTContext used to "interpret" CodeDecl.
|
||||
ASTContext& Ctx;
|
||||
|
||||
/// NumNodes - The number of nodes in the graph.
|
||||
unsigned NumNodes;
|
||||
|
||||
@ -256,7 +252,7 @@ public:
|
||||
bool* IsNew = 0);
|
||||
|
||||
ExplodedGraph* MakeEmptyGraph() const {
|
||||
return new ExplodedGraph(Ctx);
|
||||
return new ExplodedGraph();
|
||||
}
|
||||
|
||||
/// addRoot - Add an untyped node to the set of roots.
|
||||
@ -271,7 +267,7 @@ public:
|
||||
return V;
|
||||
}
|
||||
|
||||
ExplodedGraph(ASTContext& ctx) : Ctx(ctx), NumNodes(0) {}
|
||||
ExplodedGraph() : NumNodes(0) {}
|
||||
|
||||
~ExplodedGraph() {}
|
||||
|
||||
@ -318,8 +314,6 @@ public:
|
||||
llvm::BumpPtrAllocator & getAllocator() { return BVC.getAllocator(); }
|
||||
BumpVectorContext &getNodeAllocator() { return BVC; }
|
||||
|
||||
ASTContext& getContext() { return Ctx; }
|
||||
|
||||
typedef llvm::DenseMap<const ExplodedNode*, ExplodedNode*> NodeMap;
|
||||
|
||||
std::pair<ExplodedGraph*, InterExplodedGraphMap*>
|
||||
|
@ -57,6 +57,10 @@ class GRCoreEngine {
|
||||
/// These are used to record for key nodes in the ExplodedGraph the
|
||||
/// number of times different CFGBlocks have been visited along a path.
|
||||
GRBlockCounter::Factory BCounterFactory;
|
||||
|
||||
/// A flag that indicates whether paths were halted because
|
||||
/// ProcessBlockEntrace returned false.
|
||||
bool BlockAborted;
|
||||
|
||||
void GenerateNode(const ProgramPoint& Loc, const GRState* State,
|
||||
ExplodedNode* Pred);
|
||||
@ -105,17 +109,19 @@ private:
|
||||
public:
|
||||
/// Construct a GRCoreEngine object to analyze the provided CFG using
|
||||
/// a DFS exploration of the exploded graph.
|
||||
GRCoreEngine(ASTContext& ctx, GRSubEngine& subengine)
|
||||
: SubEngine(subengine), G(new ExplodedGraph(ctx)),
|
||||
GRCoreEngine(GRSubEngine& subengine)
|
||||
: SubEngine(subengine), G(new ExplodedGraph()),
|
||||
WList(GRWorkList::MakeBFS()),
|
||||
BCounterFactory(G->getAllocator()) {}
|
||||
BCounterFactory(G->getAllocator()),
|
||||
BlockAborted(false) {}
|
||||
|
||||
/// Construct a GRCoreEngine object to analyze the provided CFG and to
|
||||
/// use the provided worklist object to execute the worklist algorithm.
|
||||
/// The GRCoreEngine object assumes ownership of 'wlist'.
|
||||
GRCoreEngine(ASTContext& ctx, GRWorkList* wlist, GRSubEngine& subengine)
|
||||
: SubEngine(subengine), G(new ExplodedGraph(ctx)), WList(wlist),
|
||||
BCounterFactory(G->getAllocator()) {}
|
||||
GRCoreEngine(GRWorkList* wlist, GRSubEngine& subengine)
|
||||
: SubEngine(subengine), G(new ExplodedGraph()), WList(wlist),
|
||||
BCounterFactory(G->getAllocator()),
|
||||
BlockAborted(false) {}
|
||||
|
||||
~GRCoreEngine() {
|
||||
delete WList;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#ifndef LLVM_CLANG_ANALYSIS_GREXPRENGINE
|
||||
#define LLVM_CLANG_ANALYSIS_GREXPRENGINE
|
||||
|
||||
#include "clang/Checker/PathSensitive/AnalysisManager.h"
|
||||
#include "clang/Checker/PathSensitive/GRSubEngine.h"
|
||||
#include "clang/Checker/PathSensitive/GRCoreEngine.h"
|
||||
#include "clang/Checker/PathSensitive/GRState.h"
|
||||
@ -75,14 +76,25 @@ class GRExprEngine : public GRSubEngine {
|
||||
llvm::OwningPtr<GRSimpleAPICheck> BatchAuditor;
|
||||
|
||||
typedef llvm::DenseMap<void *, unsigned> CheckerMap;
|
||||
CheckerMap CheckerM;
|
||||
|
||||
typedef std::vector<std::pair<void *, Checker*> > CheckersOrdered;
|
||||
typedef llvm::DenseMap<std::pair<unsigned, unsigned>, CheckersOrdered *>
|
||||
CheckersOrderedCache;
|
||||
|
||||
/// A registration map from checker tag to the index into the
|
||||
/// ordered checkers vector.
|
||||
CheckerMap CheckerM;
|
||||
|
||||
/// An ordered vector of checkers that are called when evaluating
|
||||
/// various expressions and statements.
|
||||
CheckersOrdered Checkers;
|
||||
|
||||
/// BR - The BugReporter associated with this engine. It is important that
|
||||
// this object be placed at the very end of member variables so that its
|
||||
// destructor is called before the rest of the GRExprEngine is destroyed.
|
||||
/// A map used for caching the checkers that respond to the callback for
|
||||
/// a particular statement and visitation order.
|
||||
CheckersOrderedCache COCache;
|
||||
|
||||
/// The BugReporter associated with this engine. It is important that
|
||||
/// this object be placed at the very end of member variables so that its
|
||||
/// destructor is called before the rest of the GRExprEngine is destroyed.
|
||||
GRBugReporter BR;
|
||||
|
||||
llvm::OwningPtr<GRTransferFuncs> TF;
|
||||
@ -106,7 +118,7 @@ public:
|
||||
}
|
||||
|
||||
/// getContext - Return the ASTContext associated with this analysis.
|
||||
ASTContext& getContext() const { return G.getContext(); }
|
||||
ASTContext& getContext() const { return AMgr.getASTContext(); }
|
||||
|
||||
AnalysisManager &getAnalysisManager() const { return AMgr; }
|
||||
|
||||
@ -178,12 +190,15 @@ public:
|
||||
/// nodes when the control reaches the end of a function.
|
||||
void ProcessEndPath(GREndPathNodeBuilder& builder);
|
||||
|
||||
// Generate the entry node of the callee.
|
||||
/// Generate the entry node of the callee.
|
||||
void ProcessCallEnter(GRCallEnterNodeBuilder &builder);
|
||||
|
||||
// Generate the first post callsite node.
|
||||
/// Generate the first post callsite node.
|
||||
void ProcessCallExit(GRCallExitNodeBuilder &builder);
|
||||
|
||||
/// Called by GRCoreEngine when the analysis worklist has terminated.
|
||||
void ProcessEndWorklist(bool hasWorkRemaining);
|
||||
|
||||
/// EvalAssume - Callback function invoked by the ConstraintManager when
|
||||
/// making assumptions about state values.
|
||||
const GRState *ProcessAssume(const GRState *state, SVal cond, bool assumption);
|
||||
|
@ -211,16 +211,18 @@ public:
|
||||
|
||||
const GRState *bindLoc(SVal location, SVal V) const;
|
||||
|
||||
const GRState *bindDefault(SVal loc, SVal V) const;
|
||||
|
||||
const GRState *unbindLoc(Loc LV) const;
|
||||
|
||||
/// Get the lvalue for a variable reference.
|
||||
SVal getLValue(const VarDecl *D, const LocationContext *LC) const;
|
||||
Loc getLValue(const VarDecl *D, const LocationContext *LC) const;
|
||||
|
||||
/// Get the lvalue for a StringLiteral.
|
||||
SVal getLValue(const StringLiteral *literal) const;
|
||||
Loc getLValue(const StringLiteral *literal) const;
|
||||
|
||||
SVal getLValue(const CompoundLiteralExpr *literal,
|
||||
const LocationContext *LC) const;
|
||||
Loc getLValue(const CompoundLiteralExpr *literal,
|
||||
const LocationContext *LC) const;
|
||||
|
||||
/// Get the lvalue for an ivar reference.
|
||||
SVal getLValue(const ObjCIvarDecl *decl, SVal base) const;
|
||||
@ -446,7 +448,7 @@ public:
|
||||
StoreManager& getStoreManager() { return *StoreMgr; }
|
||||
ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
|
||||
|
||||
const GRState* RemoveDeadBindings(const GRState* St, Stmt* Loc,
|
||||
const GRState* RemoveDeadBindings(const GRState* St,
|
||||
const StackFrameContext *LCtx,
|
||||
SymbolReaper& SymReaper);
|
||||
|
||||
@ -468,9 +470,6 @@ public:
|
||||
|
||||
const GRState* getPersistentState(GRState& Impl);
|
||||
|
||||
bool isEqual(const GRState* state, const Expr* Ex, const llvm::APSInt& V);
|
||||
bool isEqual(const GRState* state, const Expr* Ex, uint64_t);
|
||||
|
||||
//==---------------------------------------------------------------------==//
|
||||
// Generic Data Map methods.
|
||||
//==---------------------------------------------------------------------==//
|
||||
@ -620,16 +619,22 @@ inline const GRState *GRState::bindLoc(SVal LV, SVal V) const {
|
||||
return !isa<Loc>(LV) ? this : bindLoc(cast<Loc>(LV), V);
|
||||
}
|
||||
|
||||
inline SVal GRState::getLValue(const VarDecl* VD,
|
||||
inline const GRState *GRState::bindDefault(SVal loc, SVal V) const {
|
||||
const MemRegion *R = cast<loc::MemRegionVal>(loc).getRegion();
|
||||
Store new_store = getStateManager().StoreMgr->BindDefault(St, R, V);
|
||||
return makeWithStore(new_store);
|
||||
}
|
||||
|
||||
inline Loc GRState::getLValue(const VarDecl* VD,
|
||||
const LocationContext *LC) const {
|
||||
return getStateManager().StoreMgr->getLValueVar(VD, LC);
|
||||
}
|
||||
|
||||
inline SVal GRState::getLValue(const StringLiteral *literal) const {
|
||||
inline Loc GRState::getLValue(const StringLiteral *literal) const {
|
||||
return getStateManager().StoreMgr->getLValueString(literal);
|
||||
}
|
||||
|
||||
inline SVal GRState::getLValue(const CompoundLiteralExpr *literal,
|
||||
inline Loc GRState::getLValue(const CompoundLiteralExpr *literal,
|
||||
const LocationContext *LC) const {
|
||||
return getStateManager().StoreMgr->getLValueCompoundLiteral(literal, LC);
|
||||
}
|
||||
|
@ -41,27 +41,27 @@ public:
|
||||
|
||||
virtual GRStateManager& getStateManager() = 0;
|
||||
|
||||
/// ProcessStmt - Called by GRCoreEngine. Used to generate new successor
|
||||
/// nodes by processing the 'effects' of a block-level statement.
|
||||
/// Called by GRCoreEngine. Used to generate new successor
|
||||
/// nodes by processing the 'effects' of a block-level statement.
|
||||
virtual void ProcessStmt(CFGElement E, GRStmtNodeBuilder& builder) = 0;
|
||||
|
||||
/// ProcessBlockEntrance - Called by GRCoreEngine when start processing
|
||||
/// a CFGBlock. This method returns true if the analysis should continue
|
||||
/// exploring the given path, and false otherwise.
|
||||
/// Called by GRCoreEngine when start processing
|
||||
/// a CFGBlock. This method returns true if the analysis should continue
|
||||
/// exploring the given path, and false otherwise.
|
||||
virtual bool ProcessBlockEntrance(CFGBlock* B, const ExplodedNode *Pred,
|
||||
GRBlockCounter BC) = 0;
|
||||
|
||||
/// ProcessBranch - Called by GRCoreEngine. Used to generate successor
|
||||
/// Called by GRCoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a branch condition.
|
||||
virtual void ProcessBranch(Stmt* Condition, Stmt* Term,
|
||||
GRBranchNodeBuilder& builder) = 0;
|
||||
|
||||
/// ProcessIndirectGoto - Called by GRCoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a computed goto jump.
|
||||
/// Called by GRCoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a computed goto jump.
|
||||
virtual void ProcessIndirectGoto(GRIndirectGotoNodeBuilder& builder) = 0;
|
||||
|
||||
/// ProcessSwitch - Called by GRCoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a switch statement.
|
||||
/// Called by GRCoreEngine. Used to generate successor
|
||||
/// nodes by processing the 'effects' of a switch statement.
|
||||
virtual void ProcessSwitch(GRSwitchNodeBuilder& builder) = 0;
|
||||
|
||||
/// ProcessEndPath - Called by GRCoreEngine. Used to generate end-of-path
|
||||
@ -74,10 +74,14 @@ public:
|
||||
// Generate the first post callsite node.
|
||||
virtual void ProcessCallExit(GRCallExitNodeBuilder &builder) = 0;
|
||||
|
||||
/// EvalAssume - Called by ConstraintManager. Used to call checker-specific
|
||||
/// logic for handling assumptions on symbolic values.
|
||||
/// Called by ConstraintManager. Used to call checker-specific
|
||||
/// logic for handling assumptions on symbolic values.
|
||||
virtual const GRState* ProcessAssume(const GRState *state,
|
||||
SVal cond, bool assumption) = 0;
|
||||
|
||||
/// Called by GRCoreEngine when the analysis worklist is either empty or the
|
||||
// maximum number of analysis steps have been reached.
|
||||
virtual void ProcessEndWorklist(bool hasWorkRemaining) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
GRExprEngine& Engine,
|
||||
GRStmtNodeBuilder& Builder,
|
||||
ExplodedNode* Pred,
|
||||
Stmt* S, const GRState* state,
|
||||
const GRState* state,
|
||||
SymbolReaper& SymReaper) {}
|
||||
|
||||
// Return statements.
|
||||
|
@ -34,7 +34,9 @@ class MemRegionManager;
|
||||
class MemSpaceRegion;
|
||||
class LocationContext;
|
||||
class StackFrameContext;
|
||||
class ValueManager;
|
||||
class VarRegion;
|
||||
class CodeTextRegion;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Base region classes.
|
||||
@ -46,14 +48,17 @@ class MemRegion : public llvm::FoldingSetNode {
|
||||
public:
|
||||
enum Kind {
|
||||
// Memory spaces.
|
||||
BEG_MEMSPACES,
|
||||
GenericMemSpaceRegionKind = BEG_MEMSPACES,
|
||||
GenericMemSpaceRegionKind,
|
||||
StackLocalsSpaceRegionKind,
|
||||
StackArgumentsSpaceRegionKind,
|
||||
HeapSpaceRegionKind,
|
||||
UnknownSpaceRegionKind,
|
||||
GlobalsSpaceRegionKind,
|
||||
END_MEMSPACES = GlobalsSpaceRegionKind,
|
||||
NonStaticGlobalSpaceRegionKind,
|
||||
StaticGlobalSpaceRegionKind,
|
||||
BEG_GLOBAL_MEMSPACES = NonStaticGlobalSpaceRegionKind,
|
||||
END_GLOBAL_MEMSPACES = StaticGlobalSpaceRegionKind,
|
||||
BEG_MEMSPACES = GenericMemSpaceRegionKind,
|
||||
END_MEMSPACES = StaticGlobalSpaceRegionKind,
|
||||
// Untyped regions.
|
||||
SymbolicRegionKind,
|
||||
AllocaRegionKind,
|
||||
@ -146,13 +151,48 @@ public:
|
||||
};
|
||||
|
||||
class GlobalsSpaceRegion : public MemSpaceRegion {
|
||||
friend class MemRegionManager;
|
||||
|
||||
GlobalsSpaceRegion(MemRegionManager *mgr)
|
||||
: MemSpaceRegion(mgr, GlobalsSpaceRegionKind) {}
|
||||
protected:
|
||||
GlobalsSpaceRegion(MemRegionManager *mgr, Kind k)
|
||||
: MemSpaceRegion(mgr, k) {}
|
||||
public:
|
||||
static bool classof(const MemRegion *R) {
|
||||
return R->getKind() == GlobalsSpaceRegionKind;
|
||||
Kind k = R->getKind();
|
||||
return k >= BEG_GLOBAL_MEMSPACES && k <= END_GLOBAL_MEMSPACES;
|
||||
}
|
||||
};
|
||||
|
||||
class StaticGlobalSpaceRegion : public GlobalsSpaceRegion {
|
||||
friend class MemRegionManager;
|
||||
|
||||
const CodeTextRegion *CR;
|
||||
|
||||
StaticGlobalSpaceRegion(MemRegionManager *mgr, const CodeTextRegion *cr)
|
||||
: GlobalsSpaceRegion(mgr, StaticGlobalSpaceRegionKind), CR(cr) {}
|
||||
|
||||
public:
|
||||
void Profile(llvm::FoldingSetNodeID &ID) const;
|
||||
|
||||
void dumpToStream(llvm::raw_ostream& os) const;
|
||||
|
||||
const CodeTextRegion *getCodeRegion() const { return CR; }
|
||||
|
||||
static bool classof(const MemRegion *R) {
|
||||
return R->getKind() == StaticGlobalSpaceRegionKind;
|
||||
}
|
||||
};
|
||||
|
||||
class NonStaticGlobalSpaceRegion : public GlobalsSpaceRegion {
|
||||
friend class MemRegionManager;
|
||||
|
||||
NonStaticGlobalSpaceRegion(MemRegionManager *mgr)
|
||||
: GlobalsSpaceRegion(mgr, NonStaticGlobalSpaceRegionKind) {}
|
||||
|
||||
public:
|
||||
|
||||
void dumpToStream(llvm::raw_ostream& os) const;
|
||||
|
||||
static bool classof(const MemRegion *R) {
|
||||
return R->getKind() == NonStaticGlobalSpaceRegionKind;
|
||||
}
|
||||
};
|
||||
|
||||
@ -232,6 +272,11 @@ public:
|
||||
return superRegion;
|
||||
}
|
||||
|
||||
/// getExtent - Returns the size of the region in bytes.
|
||||
virtual DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const {
|
||||
return UnknownVal();
|
||||
}
|
||||
|
||||
MemRegionManager* getMemRegionManager() const;
|
||||
|
||||
bool isSubRegionOf(const MemRegion* R) const;
|
||||
@ -288,6 +333,8 @@ public:
|
||||
|
||||
bool isBoundable() const { return true; }
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const Expr* Ex,
|
||||
@ -502,6 +549,8 @@ public:
|
||||
|
||||
bool isBoundable() const { return true; }
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID,
|
||||
@ -536,6 +585,8 @@ public:
|
||||
return Str->getType();
|
||||
}
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
||||
bool isBoundable() const { return false; }
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const {
|
||||
@ -595,6 +646,8 @@ public:
|
||||
const Decl* getDecl() const { return D; }
|
||||
void Profile(llvm::FoldingSetNodeID& ID) const;
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
||||
static bool classof(const MemRegion* R) {
|
||||
unsigned k = R->getKind();
|
||||
return k >= BEG_DECL_REGIONS && k <= END_DECL_REGIONS;
|
||||
@ -679,6 +732,8 @@ public:
|
||||
return C.getCanonicalType(getDecl()->getType());
|
||||
}
|
||||
|
||||
DefinedOrUnknownSVal getExtent(ValueManager& ValMgr) const;
|
||||
|
||||
static void ProfileRegion(llvm::FoldingSetNodeID& ID, const FieldDecl* FD,
|
||||
const MemRegion* superRegion) {
|
||||
DeclRegion::ProfileRegion(ID, FD, superRegion, FieldRegionKind);
|
||||
@ -793,12 +848,14 @@ class MemRegionManager {
|
||||
llvm::BumpPtrAllocator& A;
|
||||
llvm::FoldingSet<MemRegion> Regions;
|
||||
|
||||
GlobalsSpaceRegion *globals;
|
||||
NonStaticGlobalSpaceRegion *globals;
|
||||
|
||||
llvm::DenseMap<const StackFrameContext *, StackLocalsSpaceRegion *>
|
||||
StackLocalsSpaceRegions;
|
||||
llvm::DenseMap<const StackFrameContext *, StackArgumentsSpaceRegion *>
|
||||
StackArgumentsSpaceRegions;
|
||||
llvm::DenseMap<const CodeTextRegion *, StaticGlobalSpaceRegion *>
|
||||
StaticsGlobalSpaceRegions;
|
||||
|
||||
HeapSpaceRegion *heap;
|
||||
UnknownSpaceRegion *unknown;
|
||||
@ -825,8 +882,8 @@ public:
|
||||
getStackArgumentsRegion(const StackFrameContext *STC);
|
||||
|
||||
/// getGlobalsRegion - Retrieve the memory region associated with
|
||||
/// all global variables.
|
||||
const GlobalsSpaceRegion *getGlobalsRegion();
|
||||
/// global variables.
|
||||
const GlobalsSpaceRegion *getGlobalsRegion(const CodeTextRegion *R = 0);
|
||||
|
||||
/// getHeapRegion - Retrieve the memory region associated with the
|
||||
/// generic "heap".
|
||||
|
@ -98,6 +98,8 @@ public:
|
||||
|
||||
bool isConstant() const;
|
||||
|
||||
bool isConstant(int I) const;
|
||||
|
||||
bool isZeroConstant() const;
|
||||
|
||||
/// hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
|
||||
@ -109,7 +111,7 @@ public:
|
||||
const FunctionDecl* getAsFunctionDecl() const;
|
||||
|
||||
/// getAsLocSymbol - If this SVal is a location (subclasses Loc) and
|
||||
/// wraps a symbol, return that SymbolRef. Otherwise return a SymbolData*
|
||||
/// wraps a symbol, return that SymbolRef. Otherwise return NULL.
|
||||
SymbolRef getAsLocSymbol() const;
|
||||
|
||||
/// Get the symbol in the SVal or its base region.
|
||||
|
@ -47,11 +47,15 @@ public:
|
||||
virtual SVal EvalBinOpNN(const GRState *state, BinaryOperator::Opcode Op,
|
||||
NonLoc lhs, NonLoc rhs, QualType resultTy) = 0;
|
||||
|
||||
virtual SVal EvalBinOpLL(BinaryOperator::Opcode Op, Loc lhs, Loc rhs,
|
||||
QualType resultTy) = 0;
|
||||
virtual SVal EvalBinOpLL(const GRState *state, BinaryOperator::Opcode Op,
|
||||
Loc lhs, Loc rhs, QualType resultTy) = 0;
|
||||
|
||||
virtual SVal EvalBinOpLN(const GRState *state, BinaryOperator::Opcode Op,
|
||||
Loc lhs, NonLoc rhs, QualType resultTy) = 0;
|
||||
|
||||
/// getKnownValue - Evaluates a given SVal. If the SVal has only one possible
|
||||
/// (integer) value, that value is returned. Otherwise, returns NULL.
|
||||
virtual const llvm::APSInt *getKnownValue(const GRState *state, SVal V) = 0;
|
||||
|
||||
SVal EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
|
||||
SVal L, SVal R, QualType T);
|
||||
|
@ -64,6 +64,10 @@ public:
|
||||
/// to the location given for \c loc.
|
||||
virtual Store Bind(Store store, Loc loc, SVal val) = 0;
|
||||
|
||||
virtual Store BindDefault(Store store, const MemRegion *R, SVal V) {
|
||||
return store;
|
||||
}
|
||||
|
||||
virtual Store Remove(Store St, Loc L) = 0;
|
||||
|
||||
/// BindCompoundLiteral - Return the store that has the bindings currently
|
||||
@ -87,16 +91,16 @@ public:
|
||||
// caller's responsibility to 'delete' the returned map.
|
||||
virtual SubRegionMap *getSubRegionMap(Store store) = 0;
|
||||
|
||||
virtual SVal getLValueVar(const VarDecl *VD, const LocationContext *LC) {
|
||||
virtual Loc getLValueVar(const VarDecl *VD, const LocationContext *LC) {
|
||||
return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
|
||||
}
|
||||
|
||||
virtual SVal getLValueString(const StringLiteral* S) {
|
||||
virtual Loc getLValueString(const StringLiteral* S) {
|
||||
return ValMgr.makeLoc(MRMgr.getStringRegion(S));
|
||||
}
|
||||
|
||||
SVal getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
|
||||
const LocationContext *LC) {
|
||||
Loc getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
|
||||
const LocationContext *LC) {
|
||||
return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
|
||||
}
|
||||
|
||||
@ -110,7 +114,8 @@ public:
|
||||
|
||||
virtual SVal getLValueElement(QualType elementType, SVal offset, SVal Base);
|
||||
|
||||
// FIXME: Make out-of-line.
|
||||
// FIXME: This should soon be eliminated altogether; clients should deal with
|
||||
// region extents directly.
|
||||
virtual DefinedOrUnknownSVal getSizeInElements(const GRState *state,
|
||||
const MemRegion *region,
|
||||
QualType EleTy) {
|
||||
@ -144,7 +149,7 @@ public:
|
||||
return UnknownVal();
|
||||
}
|
||||
|
||||
virtual const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,
|
||||
virtual const GRState *RemoveDeadBindings(GRState &state,
|
||||
const StackFrameContext *LCtx,
|
||||
SymbolReaper& SymReaper,
|
||||
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) = 0;
|
||||
@ -164,18 +169,8 @@ public:
|
||||
const MemRegion * const *Begin,
|
||||
const MemRegion * const *End,
|
||||
const Expr *E, unsigned Count,
|
||||
InvalidatedSymbols *IS);
|
||||
|
||||
// FIXME: Make out-of-line.
|
||||
virtual const GRState *setExtent(const GRState *state,
|
||||
const MemRegion *region, SVal extent) {
|
||||
return state;
|
||||
}
|
||||
|
||||
virtual llvm::Optional<SVal> getExtent(const GRState *state,
|
||||
const MemRegion *R) {
|
||||
return llvm::Optional<SVal>();
|
||||
}
|
||||
InvalidatedSymbols *IS,
|
||||
bool invalidateGlobals) = 0;
|
||||
|
||||
/// EnterStackFrame - Let the StoreManager to do something when execution
|
||||
/// engine is about to execute into a callee.
|
||||
|
@ -31,6 +31,7 @@ namespace clang {
|
||||
class ASTContext;
|
||||
class BasicValueFactory;
|
||||
class MemRegion;
|
||||
class SubRegion;
|
||||
class TypedRegion;
|
||||
class VarRegion;
|
||||
class StackFrameContext;
|
||||
@ -38,7 +39,7 @@ namespace clang {
|
||||
class SymExpr : public llvm::FoldingSetNode {
|
||||
public:
|
||||
enum Kind { BEGIN_SYMBOLS,
|
||||
RegionValueKind, ConjuredKind, DerivedKind,
|
||||
RegionValueKind, ConjuredKind, DerivedKind, ExtentKind,
|
||||
END_SYMBOLS,
|
||||
SymIntKind, SymSymKind };
|
||||
private:
|
||||
@ -189,6 +190,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class SymbolExtent : public SymbolData {
|
||||
const SubRegion *R;
|
||||
|
||||
public:
|
||||
SymbolExtent(SymbolID sym, const SubRegion *r)
|
||||
: SymbolData(ExtentKind, sym), R(r) {}
|
||||
|
||||
const SubRegion *getRegion() const { return R; }
|
||||
|
||||
QualType getType(ASTContext&) const;
|
||||
|
||||
void dumpToStream(llvm::raw_ostream &os) const;
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID& profile, const SubRegion *R) {
|
||||
profile.AddInteger((unsigned) ExtentKind);
|
||||
profile.AddPointer(R);
|
||||
}
|
||||
|
||||
virtual void Profile(llvm::FoldingSetNodeID& profile) {
|
||||
Profile(profile, R);
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
static inline bool classof(const SymExpr* SE) {
|
||||
return SE->getKind() == ExtentKind;
|
||||
}
|
||||
};
|
||||
|
||||
// SymIntExpr - Represents symbolic expression like 'x' + 3.
|
||||
class SymIntExpr : public SymExpr {
|
||||
const SymExpr *LHS;
|
||||
@ -305,6 +334,8 @@ public:
|
||||
const SymbolDerived *getDerivedSymbol(SymbolRef parentSymbol,
|
||||
const TypedRegion *R);
|
||||
|
||||
const SymbolExtent *getExtentSymbol(const SubRegion *R);
|
||||
|
||||
const SymIntExpr *getSymIntExpr(const SymExpr *lhs, BinaryOperator::Opcode op,
|
||||
const llvm::APSInt& rhs, QualType t);
|
||||
|
||||
@ -330,21 +361,23 @@ class SymbolReaper {
|
||||
SetTy TheLiving;
|
||||
SetTy TheDead;
|
||||
const LocationContext *LCtx;
|
||||
const Stmt *Loc;
|
||||
SymbolManager& SymMgr;
|
||||
|
||||
public:
|
||||
SymbolReaper(const LocationContext *ctx, SymbolManager& symmgr)
|
||||
: LCtx(ctx), SymMgr(symmgr) {}
|
||||
SymbolReaper(const LocationContext *ctx, const Stmt *s, SymbolManager& symmgr)
|
||||
: LCtx(ctx), Loc(s), SymMgr(symmgr) {}
|
||||
|
||||
~SymbolReaper() {}
|
||||
|
||||
const LocationContext *getLocationContext() const { return LCtx; }
|
||||
const Stmt *getCurrentStatement() const { return Loc; }
|
||||
|
||||
bool isLive(SymbolRef sym);
|
||||
|
||||
bool isLive(const Stmt* Loc, const Stmt* ExprVal) const;
|
||||
bool isLive(const Stmt *ExprVal) const;
|
||||
|
||||
bool isLive(const Stmt* Loc, const VarRegion *VR) const;
|
||||
bool isLive(const VarRegion *VR) const;
|
||||
|
||||
void markLive(SymbolRef sym);
|
||||
bool maybeDead(SymbolRef sym);
|
||||
|
37
include/clang/CodeGen/BackendUtil.h
Normal file
37
include/clang/CodeGen/BackendUtil.h
Normal file
@ -0,0 +1,37 @@
|
||||
//===--- BackendUtil.h - LLVM Backend Utilities -----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_CODEGEN_BACKEND_UTIL_H
|
||||
#define LLVM_CLANG_CODEGEN_BACKEND_UTIL_H
|
||||
|
||||
namespace llvm {
|
||||
class Module;
|
||||
class raw_ostream;
|
||||
}
|
||||
|
||||
namespace clang {
|
||||
class Diagnostic;
|
||||
class CodeGenOptions;
|
||||
class TargetOptions;
|
||||
|
||||
enum BackendAction {
|
||||
Backend_EmitAssembly, ///< Emit native assembly files
|
||||
Backend_EmitBC, ///< Emit LLVM bitcode files
|
||||
Backend_EmitLL, ///< Emit human-readable LLVM assembly
|
||||
Backend_EmitNothing, ///< Don't emit anything (benchmarking mode)
|
||||
Backend_EmitMCNull, ///< Run CodeGen, but don't emit anything
|
||||
Backend_EmitObj ///< Emit native object files
|
||||
};
|
||||
|
||||
void EmitBackendOutput(Diagnostic &Diags, const CodeGenOptions &CGOpts,
|
||||
const TargetOptions &TOpts, llvm::Module *M,
|
||||
BackendAction Action, llvm::raw_ostream *OS);
|
||||
}
|
||||
|
||||
#endif
|
@ -7,6 +7,9 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CLANG_CODEGEN_CODE_GEN_ACTION_H
|
||||
#define LLVM_CLANG_CODEGEN_CODE_GEN_ACTION_H
|
||||
|
||||
#include "clang/Frontend/FrontendAction.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
|
||||
@ -24,9 +27,13 @@ private:
|
||||
protected:
|
||||
CodeGenAction(unsigned _Act);
|
||||
|
||||
virtual bool hasIRSupport() const;
|
||||
|
||||
virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI,
|
||||
llvm::StringRef InFile);
|
||||
|
||||
virtual void ExecuteAction();
|
||||
|
||||
virtual void EndSourceFileAction();
|
||||
|
||||
public:
|
||||
@ -68,3 +75,5 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -33,6 +33,9 @@ namespace clang {
|
||||
virtual llvm::Module* ReleaseModule() = 0;
|
||||
};
|
||||
|
||||
/// CreateLLVMCodeGen - Create a CodeGenerator instance.
|
||||
/// It is the responsibility of the caller to call delete on
|
||||
/// the allocated CodeGenerator instance.
|
||||
CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags,
|
||||
const std::string &ModuleName,
|
||||
const CodeGenOptions &CGO,
|
||||
|
@ -51,9 +51,10 @@ public:
|
||||
AssembleJobClass,
|
||||
LinkJobClass,
|
||||
LipoJobClass,
|
||||
DsymutilJobClass,
|
||||
|
||||
JobClassFirst=PreprocessJobClass,
|
||||
JobClassLast=LipoJobClass
|
||||
JobClassLast=DsymutilJobClass
|
||||
};
|
||||
|
||||
static const char *getClassName(ActionClass AC);
|
||||
@ -211,6 +212,16 @@ public:
|
||||
static bool classof(const LipoJobAction *) { return true; }
|
||||
};
|
||||
|
||||
class DsymutilJobAction : public JobAction {
|
||||
public:
|
||||
DsymutilJobAction(ActionList &Inputs, types::ID Type);
|
||||
|
||||
static bool classof(const Action *A) {
|
||||
return A->getKind() == DsymutilJobClass;
|
||||
}
|
||||
static bool classof(const DsymutilJobAction *) { return true; }
|
||||
};
|
||||
|
||||
} // end namespace driver
|
||||
} // end namespace clang
|
||||
|
||||
|
@ -10,14 +10,9 @@
|
||||
#ifndef CLANG_DRIVER_ARG_H_
|
||||
#define CLANG_DRIVER_ARG_H_
|
||||
|
||||
#include "llvm/Support/Casting.h"
|
||||
using llvm::isa;
|
||||
using llvm::cast;
|
||||
using llvm::cast_or_null;
|
||||
using llvm::dyn_cast;
|
||||
using llvm::dyn_cast_or_null;
|
||||
|
||||
#include "Util.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@ -34,19 +29,10 @@ namespace driver {
|
||||
/// ArgList to provide efficient iteration over all instances of a
|
||||
/// particular option.
|
||||
class Arg {
|
||||
public:
|
||||
enum ArgClass {
|
||||
FlagClass = 0,
|
||||
PositionalClass,
|
||||
JoinedClass,
|
||||
SeparateClass,
|
||||
CommaJoinedClass,
|
||||
JoinedAndSeparateClass
|
||||
};
|
||||
Arg(const Arg &); // DO NOT IMPLEMENT
|
||||
void operator=(const Arg &); // DO NOT IMPLEMENT
|
||||
|
||||
private:
|
||||
ArgClass Kind;
|
||||
|
||||
/// The option this argument is an instance of.
|
||||
const Option *Opt;
|
||||
|
||||
@ -58,20 +44,24 @@ namespace driver {
|
||||
/// ArgList.
|
||||
unsigned Index;
|
||||
|
||||
/// Flag indicating whether this argument was used to effect
|
||||
/// compilation; used for generating "argument unused"
|
||||
/// diagnostics.
|
||||
mutable bool Claimed;
|
||||
/// Was this argument used to effect compilation; used for generating
|
||||
/// "argument unused" diagnostics.
|
||||
mutable unsigned Claimed : 1;
|
||||
|
||||
protected:
|
||||
Arg(ArgClass Kind, const Option *Opt, unsigned Index,
|
||||
const Arg *BaseArg = 0);
|
||||
/// Does this argument own its values.
|
||||
mutable unsigned OwnsValues : 1;
|
||||
|
||||
/// The argument values, as C strings.
|
||||
llvm::SmallVector<const char *, 2> Values;
|
||||
|
||||
public:
|
||||
Arg(const Arg &);
|
||||
virtual ~Arg();
|
||||
Arg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0);
|
||||
Arg(const Option *Opt, unsigned Index,
|
||||
const char *Value0, const Arg *BaseArg = 0);
|
||||
Arg(const Option *Opt, unsigned Index,
|
||||
const char *Value0, const char *Value1, const Arg *BaseArg = 0);
|
||||
~Arg();
|
||||
|
||||
ArgClass getKind() const { return Kind; }
|
||||
const Option &getOption() const { return *Opt; }
|
||||
unsigned getIndex() const { return Index; }
|
||||
|
||||
@ -85,19 +75,32 @@ namespace driver {
|
||||
BaseArg = _BaseArg;
|
||||
}
|
||||
|
||||
bool getOwnsValues() const { return OwnsValues; }
|
||||
void setOwnsValues(bool Value) const { OwnsValues = Value; }
|
||||
|
||||
bool isClaimed() const { return getBaseArg().Claimed; }
|
||||
|
||||
/// claim - Set the Arg claimed bit.
|
||||
|
||||
// FIXME: We need to deal with derived arguments and set the bit
|
||||
// in the original argument; not the derived one.
|
||||
void claim() const { getBaseArg().Claimed = true; }
|
||||
|
||||
virtual unsigned getNumValues() const = 0;
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const = 0;
|
||||
unsigned getNumValues() const { return Values.size(); }
|
||||
const char *getValue(const ArgList &Args, unsigned N=0) const {
|
||||
return Values[N];
|
||||
}
|
||||
|
||||
llvm::SmallVectorImpl<const char*> &getValues() {
|
||||
return Values;
|
||||
}
|
||||
|
||||
bool containsValue(llvm::StringRef Value) const {
|
||||
for (unsigned i = 0, e = getNumValues(); i != e; ++i)
|
||||
if (Values[i] == Value)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// render - Append the argument onto the given array as strings.
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const = 0;
|
||||
void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
/// renderAsInput - Append the argument, render as an input, onto
|
||||
/// the given array as strings. The distinction is that some
|
||||
@ -114,116 +117,6 @@ namespace driver {
|
||||
std::string getAsString(const ArgList &Args) const;
|
||||
};
|
||||
|
||||
/// FlagArg - An argument with no value.
|
||||
class FlagArg : public Arg {
|
||||
public:
|
||||
FlagArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return 0; }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::FlagClass;
|
||||
}
|
||||
static bool classof(const FlagArg *) { return true; }
|
||||
};
|
||||
|
||||
/// PositionalArg - A simple positional argument.
|
||||
class PositionalArg : public Arg {
|
||||
public:
|
||||
PositionalArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return 1; }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::PositionalClass;
|
||||
}
|
||||
static bool classof(const PositionalArg *) { return true; }
|
||||
};
|
||||
|
||||
/// JoinedArg - A single value argument where the value is joined
|
||||
/// (suffixed) to the option.
|
||||
class JoinedArg : public Arg {
|
||||
public:
|
||||
JoinedArg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return 1; }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::JoinedClass;
|
||||
}
|
||||
static bool classof(const JoinedArg *) { return true; }
|
||||
};
|
||||
|
||||
/// SeparateArg - An argument where one or more values follow the
|
||||
/// option specifier immediately in the argument vector.
|
||||
class SeparateArg : public Arg {
|
||||
unsigned NumValues;
|
||||
|
||||
public:
|
||||
SeparateArg(const Option *Opt, unsigned Index, unsigned NumValues,
|
||||
const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return NumValues; }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::SeparateClass;
|
||||
}
|
||||
static bool classof(const SeparateArg *) { return true; }
|
||||
};
|
||||
|
||||
/// CommaJoinedArg - An argument with multiple values joined by
|
||||
/// commas and joined (suffixed) to the option specifier.
|
||||
///
|
||||
/// The key point of this arg is that it renders its values into
|
||||
/// separate arguments, which allows it to be used as a generic
|
||||
/// mechanism for passing arguments through to tools.
|
||||
class CommaJoinedArg : public Arg {
|
||||
std::vector<std::string> Values;
|
||||
|
||||
public:
|
||||
CommaJoinedArg(const Option *Opt, unsigned Index, const char *Str,
|
||||
const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return Values.size(); }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::CommaJoinedClass;
|
||||
}
|
||||
static bool classof(const CommaJoinedArg *) { return true; }
|
||||
};
|
||||
|
||||
/// JoinedAndSeparateArg - An argument with both joined and separate
|
||||
/// values.
|
||||
class JoinedAndSeparateArg : public Arg {
|
||||
public:
|
||||
JoinedAndSeparateArg(const Option *Opt, unsigned Index,
|
||||
const Arg *BaseArg = 0);
|
||||
|
||||
virtual void render(const ArgList &Args, ArgStringList &Output) const;
|
||||
|
||||
virtual unsigned getNumValues() const { return 2; }
|
||||
virtual const char *getValue(const ArgList &Args, unsigned N=0) const;
|
||||
|
||||
static bool classof(const Arg *A) {
|
||||
return A->getKind() == Arg::JoinedAndSeparateClass;
|
||||
}
|
||||
static bool classof(const JoinedAndSeparateArg *) { return true; }
|
||||
};
|
||||
} // end namespace driver
|
||||
} // end namespace clang
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user