Files
UnrealEngineUWP/Engine/Source/Programs/UnrealCodeAnalyzer/Private/MacroCallback.h
Mikolaj Sieluzycki 13819dc17d Make UnrealCodeAnalyzer public.
- Move UnrealCodeAnalyzer to Programs/UnrealCodeAnalyzer
- Move clang/llvm binaries and includes to ThirdParty/llvm
#codereview Robert.Manuszewski

[CL 2613304 by Mikolaj Sieluzycki in Main branch]
2015-07-08 05:11:51 -04:00

39 lines
1.6 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
namespace UnrealCodeAnalyzer
{
class FMacroCallback : public clang::PPCallbacks
{
public:
FMacroCallback(clang::StringRef Filename, clang::SourceManager& SourceManager, const clang::Preprocessor& Preprocessor);
virtual void MacroExpands(const clang::Token &MacroNameTok, const clang::MacroDirective *MD, clang::SourceRange Range, const clang::MacroArgs *Args) override;
virtual void MacroDefined(const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
virtual void If(clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue) override;
virtual void Elif(clang::SourceLocation Loc, clang::SourceRange ConditionRange, ConditionValueKind ConditionValue, clang::SourceLocation IfLoc) override;
virtual void Ifdef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
virtual void Ifndef(clang::SourceLocation Loc, const clang::Token &MacroNameTok, const clang::MacroDirective *MD) override;
FPreHashedIncludeSetMap& GetIncludes()
{
return Includes;
}
private:
bool IsMacroDefinedInCommandLine(clang::StringRef Macro);
bool IsPredefinedMacro(clang::StringRef Macro);
bool FMacroCallback::IsBuiltInMacro(const clang::MacroDirective* MacroDirective);
clang::StringRef Filename;
clang::SourceManager& SourceManager;
const clang::Preprocessor& Preprocessor;
TMap<FString, FString> MacroDefinitionToFile;
FPreHashedIncludeSetMap Includes;
static ELogVerbosity::Type LogVerbosity;
};
}