Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(418)

Side by Side Diff: lib/Lex/PPMacroExpansion.cpp

Issue 5430043: implement __has_feature(address_sanitizer) Base URL: https://llvm.org/svn/llvm-project/cfe/trunk/
Patch Set: use lang options only Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Frontend/CompilerInvocation.cpp ('k') | test/Lexer/has_feature_address_sanitizer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===--- MacroExpansion.cpp - Top level Macro Expansion -------------------===// 1 //===--- MacroExpansion.cpp - Top level Macro Expansion -------------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file implements the top level handling of macro expasion for the 10 // This file implements the top level handling of macro expasion for the
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 TIMELoc = TmpTok.getLocation(); 576 TIMELoc = TmpTok.getLocation();
577 } 577 }
578 578
579 579
580 /// HasFeature - Return true if we recognize and implement the feature 580 /// HasFeature - Return true if we recognize and implement the feature
581 /// specified by the identifier as a standard language feature. 581 /// specified by the identifier as a standard language feature.
582 static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { 582 static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
583 const LangOptions &LangOpts = PP.getLangOptions(); 583 const LangOptions &LangOpts = PP.getLangOptions();
584 584
585 return llvm::StringSwitch<bool>(II->getName()) 585 return llvm::StringSwitch<bool>(II->getName())
586 .Case("address_sanitizer", LangOpts.AddressSanitizer)
586 .Case("attribute_analyzer_noreturn", true) 587 .Case("attribute_analyzer_noreturn", true)
587 .Case("attribute_availability", true) 588 .Case("attribute_availability", true)
588 .Case("attribute_cf_returns_not_retained", true) 589 .Case("attribute_cf_returns_not_retained", true)
589 .Case("attribute_cf_returns_retained", true) 590 .Case("attribute_cf_returns_retained", true)
590 .Case("attribute_deprecated_with_message", true) 591 .Case("attribute_deprecated_with_message", true)
591 .Case("attribute_ext_vector_type", true) 592 .Case("attribute_ext_vector_type", true)
592 .Case("attribute_ns_returns_not_retained", true) 593 .Case("attribute_ns_returns_not_retained", true)
593 .Case("attribute_ns_returns_retained", true) 594 .Case("attribute_ns_returns_retained", true)
594 .Case("attribute_ns_consumes_self", true) 595 .Case("attribute_ns_consumes_self", true)
595 .Case("attribute_ns_consumed", true) 596 .Case("attribute_ns_consumed", true)
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 Tok.getLocation(), Tok.getLocation()); 1104 Tok.getLocation(), Tok.getLocation());
1104 } 1105 }
1105 1106
1106 void Preprocessor::markMacroAsUsed(MacroInfo *MI) { 1107 void Preprocessor::markMacroAsUsed(MacroInfo *MI) {
1107 // If the 'used' status changed, and the macro requires 'unused' warning, 1108 // If the 'used' status changed, and the macro requires 'unused' warning,
1108 // remove its SourceLocation from the warn-for-unused-macro locations. 1109 // remove its SourceLocation from the warn-for-unused-macro locations.
1109 if (MI->isWarnIfUnused() && !MI->isUsed()) 1110 if (MI->isWarnIfUnused() && !MI->isUsed())
1110 WarnUnusedMacroLocs.erase(MI->getDefinitionLoc()); 1111 WarnUnusedMacroLocs.erase(MI->getDefinitionLoc());
1111 MI->setIsUsed(true); 1112 MI->setIsUsed(true);
1112 } 1113 }
OLDNEW
« no previous file with comments | « lib/Frontend/CompilerInvocation.cpp ('k') | test/Lexer/has_feature_address_sanitizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b